input question

hi im trying to add an exit on my game.

i have this script on an empty so that when he hits space he goes back to a main menu scene
i added the name of the level in the inspector and have it under the game build.

doesnt work though.

#pragma strict
var levelToLoad:String;
function Start () {

}

function update () {
if(Input.GetButtonUp("Jump")){
		 yield new WaitForSeconds(0.1);
   Application.LoadLevel (levelToLoad);
	}
}

That should work… I do seem to have issues with yield though sometimes.

Why do you need to wait .1 seconds?

you could implement another sort of timer using Time.deltaTime.

Also, is your “Jump” set to be space bar?