Application.LoadLevel is deprecated

Application.LoadLevel is deprecated. As of now it still works but generates errors. What to change in this program is shown below:

At the top of LevelManager you should put
using UnityEngine.SceneManagement;

In LevelManager.LoadLevel, you have
Application.LoadLevel(name);
which should be changed to
SceneManager.LoadScene(name);

and in LevelManager.LoadNextLevel you have
Application.LoadLevel(Application.loadedLevel + 1);
which should now be changed to
SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);

I believe that was all that needed to change.

Privacy & Terms