Load the next level using SceneManager


I’m almost done with my first game and it’s really exciting but I’m running into an issue. I’d like to just have the next level load as soon as the boss is destroyed but rather than adding a ton of “if” statements or multiple boss scripts to change levels, I’d like the script to just go to the next level in build settings so it’d be like: If the boss of level 2 was beaten, load current level +1 so level 3…

I know Application is obsolete so I’m trying to use Scene Manager and this is the what I have

public void NextLevel()
    SceneManager.LoadScene(SceneManager.sceneCount +1);

The boss script calls NextLevel from the GameController script but currently it just reloads the current level instead of moving on.

Any help would be awesome. Thank you in advance.

Please do not take offense but there is a typo:-

SceneManager.LoadScene(SceneManager.GetActiceScene().buildIndex + 1);

should be

SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);

but thanks. It help me out too :slight_smile: