I have a script. I want it to load a scene when I push down a key. In this case the Space bar. However it does not work. I really do not know what is bad with it. I am new to unity scripting and I am pretty sure its just my script. Here is my code:

function Update() {
if(Input.GetButton("Jump")){
Application.LoadLevel (3);
}
}

Any help would be apreciated. :) Thank you.

Ok the script looks good to me but what you need to do is go to unity, click on file then build setting. Once you lick on build settings a menu will show up. In that menu there should be a field called "Scenes In Build", in this list you should have nothing. What you need to do is go to you "Project" view window and look for your scene once you find it drop and drop it on to your "Scenes In Build " window. Once you have done that the build view will add it to the list and on the side of the scene you will see a number 0 or 1. what this means is it has numbered the scene so like in your script you said load (3) that means the build will look for the number 3 and load that level.

the second thing is have you add this to your object if you have not it wont work.

and finally don't say:

Application.LoadLevel (3);

because in unity when you build a new scene and add it to the Build it will put this level above each other and it is one big problem.

instead use it like this :

 Application.LoadLevel ("Level1"); 

so instead of putting 1 put you scene name in there

hope this helped :)

Hi,

Did you check the list of levels in the game? Use File->Build Settings

I mean, is there any level number 3?

Anyway, check the documentation if you didn't...

Hello, Basically you write Application.LoadLevel(“SceneNameDesired”);
Then you have to go into Build Settings and drag the scene into the box with your current scene, should have two scenes after in build settings. Then it should work

How can i attach this script to a touch Guibuttom?