- Home /
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
Answer by Peter G · May 14, 2011 at 03:14 PM
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);
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613134200im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
error CS0103: The name `wing' does not exist in the current context 2 Answers
error CS0103 How do you fix this? 0 Answers
Disabling function of a key 1 Answer
I'm wondering with if function working 2 Answers
MouseLook half disabling 1 Answer