x


script help needed

how do i do this??

function Update () {
     animation.Play("Loading");
else if (animation))
     animation.Stop("Loading");
     Application.LoadLevel (1);
    }

it doesnt work at all it is suposed to play the loading animation and at that time preload sene 1 so it doesnt load it afther.can you please fix this for me thanks

more ▼

asked May 14 '11 at 02:42 PM

wesley gravatar image

wesley
48 24 38 46

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

1 answer: sort voted first

You can't have an else if without an if for starters.

Also, preloading is done with LoadLevelAsync(). What your doing is loading the level which will freeze the current level.

So you probably want to do something more like:

function Start () {
     if(animation)  //is there and animation component on this object
          animation.Play("Loading");

     var async : AsyncOperation = Application.LoadLevelAsync (1);
     yield async; //Wait while the level is loading in the background

     Application.LoadLevel(1);
}
more ▼

answered May 14 '11 at 03:14 PM

Peter G gravatar image

Peter G
15k 16 44 136

(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:

x76
x16

asked: May 14 '11 at 02:42 PM

Seen: 263 times

Last Updated: May 14 '11 at 02:42 PM