SoyBoy Goal to Play New Levels

I am wondering how you could change the code to make it where once you reach the goal it takes you to the next level. I tried messing around in the goal script and changing GameManager.instance.RestartLevel(0.5f); to something like SceneManager.LoadScene(“Level2”); but its not quite working. Any ideas?

In case anyone else was wondering I figured out how to do this by adding this code:
SceneManager.LoadScene(“Level2”, LoadSceneMode.Single);

@tweaver Thank you for sharing the solution - much appreciated!

For future reference and when implementing a full game with multiple levels you should definitely consider creating some sort of level manager entity. Structuring your levels in a way that they can be loaded incrementally would also help.

Multiple scenes per level is ineffecient in most cases and when using serialized data for your levels (see the Saving Data chapter) you’d want to rather use a single ‘Game’ scene that your levels get loaded into. You could have a LevelManager that keeps track of level progress or a level number as the player progresses and when it comes time to change to the next level you just look at a property on your level manager that contains the current level number and then increment that by 1.

From there you’ll need to have your level data files saved by number and you can implement a custom level loader method that looks at the next level number and loads the file into the game scene by using the number to find the correct level data file.

Hope that helps.