- Home /
Loading A Level After 40 Seconds
I have a cut scene that is exactly 40 seconds long and I am a pretty good javascript coder, i was trying to make a javascript that would load level one after 40 seconds. this is the script i was using function Update () { yield WaitForSeconds(40.0); Application.LoadLevel("FourBloods (Level 1)"); }
but i just get an error that says Script Error coroutine and when i double click it to see what is wrong another error pops up that says null reference to an object and a buch of other stuff. can anyone help or give me a new script, make sure you tell me if the script is C#, Java, or Boo
Answer by Eric5h5 · Aug 01, 2011 at 12:40 AM
Update runs every frame; it can't be paused or interrupted, or made into a coroutine. Don't use Update unless you want something to happen every frame. Use Start instead, which can be a coroutine. (Incidentally, Unity doesn't use Java.)
Thank you so much, you just made my day (-: and by java i meant javascript i was just to lazy to write it but you just save me alot of work thanks dude (-:
Answer by Statement · Aug 01, 2011 at 02:05 AM
UnityScript (.js):
var level : String = "FourBloods (Level 1)";
var delay : int = 40;
Invoke("Load", delay);
function Load() {
Application.LoadLevel(level);
}
thats okay, i already had an answer, the one above
Your answer
Follow this Question
Related Questions
Jump, fall, and after determined time it's able to jump again. 2 Answers
make an event occur after so many seconds? 1 Answer
New Level (Scene) after Enemies are gone 1 Answer
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
when i click the GUI button it doesnt load the level 1 Answer