Multiple scenes playing at once in Unity

Viewed 3509

So the problem is i've just added a simple menu system to my game and it seems to load both scenes at the same time. The game is running in the background which is annoying, but somehow after pressing play it resets the game scene and starts playing the game normally. In the build settings the gamescene is named pretty weirdly, but every time i drag my game scene from the hierarchy, it gives me that name in the build settings. Any tips on how to make the scenes work properly?

Image of my Build settings

public class MainMenuN : MonoBehaviour
{
    public void PlayGame()
    {
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
    }
    public void QuitGame (){
        Debug.Log("QUIT");
        Application.Quit();
    } 
}
1 Answers

Well, you have currently both scenes loaded in the Hierarchy!

So when pressing play to enter the playmode both scenes are loaded and running.

Then after pressing the button your do SceneManager.LoadScene without passing in the mode parameter, so it uses the default mode which is Single.

Closes all current loaded Scenes and loads a Scene.

That's why it works after that since this makes all currently loaded scenes be unloaded and the target scene loaded.


This Multi Scene Editing is a pure editor feature and will not behave like that in a build where only the very first scene from the settings will be loaded.

Especially be careful with cross scene references!


For testing correctly in the editor and replicate the same behavior your app will have after building save and then remove the second scene (Ropesgame) from the Hierarchy.

Related