SceneManager.UnloadSceneAsync followed by LoadSceneAsync, loads the scene twice
Using Unity 5.6.2f1
I had a game where a player moves from one scene to another. So the player starts in scene A, then I call:
SceneManager.LoadSceneAsync("mission1", LoadSceneMode.Additive);
This loads the mission scene. Works great. When the player finishes the mission and moves back to scene A, I call:
SceneManager.UnloadSceneAsync("mission1");
That blows away the mission1 scene from the hierarchy. That's works great too.
The problem is when the player goes to the next mission and I call
SceneManager.LoadSceneAsync("mission2", LoadSceneMode.Additive);
It loads two copies of the mission2 scene into the project hierarchy when it should just load one. All game objects are duplicated.
If I do this same thing again and move to mission3, now 3 copies of mission3 will load with a single LoadSceneAsync call.
Your answer
Follow this Question
Related Questions
How to access a GameObject in another scene? 2 Answers
Keeping track of the previous scene 1 Answer
Lifes count resets with level 0 Answers