x


Level changing and build issue

I've run into a bit of a snag with level changing.

In my Start Menu (Level 0), I use this script to make the 'Play' button go to an opening video (which is in the build settings as level 1)

if (GUI.Button( Rect( (Screen.width/2)-70, Screen.height -160, 140, 70), "Play"))
{
isLoading = true;
Application.LoadLevel(1);
}

When I click play in the editor, it goes to level 1 and plays the video. In my video is this code:

function Start(){
        guiTexture.texture.Play();
    }
    function Update(){
                if(!guiTexture.texture.isPlaying){
               Application.LoadLevel (2);
        }
    }

Which changes the level to my main level after the movie has played.

However, when build the game and test play it, clicking 'play' takes me immediately to my main level (2).

What am I doing wrong? Why does it work in the editor but not in the game?

ALSO:

I have a chain of levels set up to play to go from day to night cycles.

This is the code I use to test the levels will load in the right order.

function Start ()

{

yield WaitForSeconds (20);

Application.LoadLevel(4);
}

It loads after 20 seconds, but it doesn't load level 4 - it loads level 0. I've tried using the title instead of number ( Application.LoadLevel("Night_2"); ) but this just loads the same level as the one I am in.

I am baffled.

more ▼

asked May 14 '10 at 06:04 AM

Vonnibles gravatar image

Vonnibles
39 4 4 11

(comments are locked)
10|3000 characters needed characters left

2 answers: sort voted first

Well I'm not sure what the problem was but the first was solved by re-importing the video files and the second issue vanished when I used a code to fade to an image, the the Next level.

more ▼

answered May 19 '10 at 09:15 AM

Vonnibles gravatar image

Vonnibles
39 4 4 11

(comments are locked)
10|3000 characters needed characters left

For your second problem, have you go to Build Settings and add your new level?

more ▼

answered May 14 '10 at 08:08 AM

Extrakun gravatar image

Extrakun
1.3k 44 56 70

Yeah, I've double checked. All levels are loaded into build settings. :(

May 14 '10 at 10:39 AM Vonnibles
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x663
x322
x263

asked: May 14 '10 at 06:04 AM

Seen: 1503 times

Last Updated: May 14 '10 at 06:04 AM