Load Level script problem

So i have MainMenu scene, EndLevel scene, and 8 Levels scenes (Names: Level01, Level02,Level03…). On MainMenu and EndLevel i have button and added the function StartGameNew
this is my code:

#pragma strict
var levelNumber = 1;
function StartGameNew()
{
	Application.LoadLevel("Level0" + levelNumber);
	if(levelNumber <= 8)
	levelNumber++;
	else levelNumber = 1;
}

The problem is here when i click on the button play again this error pops up:
Scene ‘Level00’ (-1) couldn’t be loaded because it has not been added to the build settings or the asset bundle has not been loaded.
To add a scene to the build settings use the menu File->Build Settings…

Why it wants to load Scene ‘Level00’ ? not Level02? how to fix this where is the problem in my code?

this error is because you do not put the scenes in the build settings
you have to go to File> Build Settings , and grovellest all his scenes in it and position correctly in the first place the main menu, then the scene 1,2,3 … and finally the End

try it , you’ll probably show up another error then why not make sense to me that this wanting to do this code

Scene ‘Level00’

var levelNumber = 1;
// ...
Application.LoadLevel("Level0" + levelNumber);

levelNumber must then be zero. If you for example originally had levelNumber as 0, or changed levelNumber in the inspector to 0, it will retain that information.

Why it wants to load Scene ‘Level00’ ? not Level02?

Well, first I don’t understand why you expect it to load Level02. I could agree that you could expect it to load Level01 because levelNumber is 1 in the script. However levelNumber is a public, serialized variable and if you check the number on the script on the inspector, you’ll find out it’s 0. Why? Because one power of Unity is to be able drive data from the editor.

Simple fix. Change it to 1 or 2 or whatever you want it to be in the inspector. If you don’t want that variable to be editable in the inspector, you can make it private.

private var levelNumber = 1;