Unity 5 level changes

Hey all! I am going through and getting used to Unity 5, refactoring my code and cleaning it up. The one hangup I currently have is my LevelManager. I know that LoadLevel is obsolete, so I changed my load level in script to:

From Application.LoadLevel(name) to SceneManager.LoadScene(name)

That actually works and I can call the next level just fine. However, when I want to auto change my level I had:

Application.LoadLevel(Application.LoadedLevel + 1)

I can not seem to find the replacement in the API. They do have:


But you cannot increment by 1. Any thoughts?

Hey @EricPhillips, how are you?

this should work:

public void LoadNextLevel()

@Joao_Dalvi well now I feel stupid lol. Thanks for that. I figured the buildindex was just a refrence to the build order and not a command I could pass an integer into. Merry Christmas :smile:

@EricPhillips, you don’t have to feel stupid for that :joy:
I’ve spent a couple of hours hammering my head on that too when I updated from unity 4 to unity 5. Which is a important process, those problems help us understand how the engine works =)

Privacy & Terms