How can I load new level each time from same button

Now I have problem … I have main menu scene that I need to back to it if the level has been passed successfully or not and there there is a button in the main menu scene (Play button)
I need to load same previous level if the level wasn’t passed and I need to load next level if the previous level has been passed successfully but all from same button (Play button)

One way is to have a script which holds a static int NextLevel. Say you have a script called MainMenu (you can use any script). When a level is complete, you do: ‘++MainMenu.NextLevel’.

When you’re back in the menu and press a button you do: Application.LoadLevel(MainMenu.NextLevel).
This should do the trick :slight_smile:

A second approach is to use PlayerPrefs. When you finish a level you do: PlayerPrefs.SetInt(“NextLevel”, Application.LoadedLevel+1);
When you press a button in the main menu to play the next level you do:

Hopes this helps you! :slight_smile: