- Home /
The question is answered, right answer was accepted
Load Level
Hi all. I've been having a problem with this script. It says "Awake is not a couroutine" How do I fix this? I want the script to play on awake and wait 10 seconds and then load another scene.
function Awake() {
{
yield WaitForSeconds (10);
Application.LoadLevel(2);
}
}
Answer by getyour411 · May 18, 2014 at 10:49 PM
Get rid of the bit that's fail. If you want more, you need to give more (i.e code), you have enough karma to know that.
Sorry I'm an idiot.
function Awake() {
{
yield WaitForSeconds (10);
Application.LoadLevel(2);
}
}
Hmm I see you have a second curly brace after function awake i'm guessing you don't need that.
Answer by brzydal · May 19, 2014 at 12:51 AM
Or start another coroutine in Awake:
function Awake()
{
Wait(10);
}
function Wait(time:float)
{
yield WaitForSeconds(time);
Application.LoadLevel(2);
}
Follow this Question
Related Questions
Setting Scroll View Width GUILayout 1 Answer
Can someone help me fix my Javascript for Flickering Light? 6 Answers
Why is my script still running in other scenes? 1 Answer
how to access objects in another scene but in the same project? 2 Answers
how to use other objects from other scenes in a script? 3 Answers