What the script of restart btn :
Application.Loadlevel (I want here an code to begin the current Scene);
What the script of restart btn :
Application.Loadlevel (I want here an code to begin the current Scene);
Hello, Abdulla Ashraf, you should write it like this:
Application.LoadLevel(your scene number here);
You need to build the scene in Build Settings.
I now that but I have more than one scene so i want if me in lvl1 begin 1 if in 2 begin 2 etc…
If you are confused on what scene number your game is, have you checked your build settings?
As you can see, when you are in your current scene you click “Add Current” this will appear in your build settings, with a number next to it. In the image example, you can see that Main.unity scene is the first build. So when you run your game, Main.unity will be the first scene to appear. If you do not have the scene in your build settings, then it won’t work. That number is the number you need to change scenes.
Application.LoadLevel(your scene number here);
Hello, Abdulla Ashraf, you should write it like this:
if(Application.loadedLevel == "1" )
{
}
or
if ( Application.loadedLevelName == "Level1" ){
}
//Keep in mind that your first scene is scene number ‘0’, your second scene is scene number ‘1’, third scene is scene number ‘2’ and so on…
//Load First level
Application.LoadLevel(0);
//Load Second level
Application.LoadLevel(1);
//Load Third level
Application.LoadLevel(2);
If you want to restart the current level you can do it like this:
Application.LoadLevel(Application.loadedLevel);
It’s that plain and simple, unless I’m misunderstanding your question.
Application.LoadLevel (LoadedLevel)
You are welcome