[Closed] My level load code isnt working

I’m very new to unity so it’s probably my error but this script isn’t working and I can’t see why it isn’t working. I don’t get an error just when I go in game and click the object nothing happens.

function OnMouseUP ()
{
Application.LoadLevel ("1");
}

That’s the whole code.

Thanks for helping

Call load level by index like this

Application.LoadLevel (1);

Using “” looks for a level named 1.

You also need to add the scene you wish to include in the Build Settings.

First of all you have to add your scenes to Build Setting -

1). Press CTRL+SHIFT+B for Windows & CMD+SHIFT+B for Mac

2). Drag and Drop your scene to “Scenes in build”, you can see your index number in right side of Build Setting window

You can load your scene by two way -

Application.LoadLevel (1);

Where 1 is the index number of your scene listed in Build Setting

Application.LoadLevel ("Scene1");

Where Scene1 is the name of scene, you can see this name in your build setting or project view.

i think what you need is this:

function Update() 
{
		if(Input.GetMouseButtonDown(0)) // waiting button left to be pressed
		{
			// Application.LoadLevel (1); 
			// Just comment out any of these
			// Application.LoadLevel ("Level Name Goes Here as string");
		}
}

Thanks fafase works perfectly now!