- Home /
Question by
TheBigBang · May 22, 2014 at 02:21 PM ·
playerfunctionyieldretry
Calling a function after game over to retry
I have this function i want to call which puts the player back to the menu after all their lives run out. Only thing is I need help calling it inside my function onGUI which shows my game over screen. I want to call the function WaitAndDie if you could help thank you
function OnGUI(){
if (playerLives == 0 && player == null){
GUI.Box(Rect(0,0,Screen.width, Screen.height), "Game Over");
spawner.GetComponent(Enemy_Spawn).isON = false;
}
}
function WaitAndDie() {
yield WaitForSeconds(4);
Application.LoadLevel ("Menu");
}
Comment
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Yield function goes slow sometimes/differently? 2 Answers
Add spawn to script [Multiplayer] 0 Answers
Can you use yield and Try/catch in the same function? 1 Answer
Yielding in between functions... 2 Answers