tim_weaver
tim_weaver

Reputation: 21

Progressing through levels as you reach a goal

I am building a game where I want the player to progress to the next level as he reaches the goal. This is the current code I am using to load the scene titled Level2:

SceneManager.LoadScene("Level2");

I can get the second level to load but for some reason the first level loads with it. Is there a piece of code I need to use that clears out level 1?

Upvotes: 1

Views: 38

Answers (1)

tim_weaver
tim_weaver

Reputation: 21

By researhing a little further I found that this can be fixed by adding:

LoadSceneMode.Single

So the final code looks like:

SceneManager.LoadScene("Level2", LoadSceneMode.Single);

However, I am still wondering if there is a better way to do this. Im still messing around with

AssetBundle.LoadFromFile

This could be a better approach. Let me know your thoughts. Thanks!

Upvotes: 1

Related Questions