SDamnation
SDamnation

Reputation: 41

How to switch between Scenes in Multi-scene view?

I'm testing out this new feature of Unity, allowing to have multiple scenes opened at once. I wonder how to load or unload a certain scene without having the main one (which is basicly UI) closed. I couldn't find any tutorials

Upvotes: 3

Views: 598

Answers (1)

Mike dg
Mike dg

Reputation: 4658

You'll want to use the SceneManager and the additive loading capability. Additive loading means that previous scenes will not be cleared out when the new scene loads.

       SceneManager.LoadScene("YourScene", LoadSceneMode.Additive); //Additive
       SceneManager.LoadScene("YourScene", LoadSceneMode.Single); //Conventional loading

Just remember that the lighting settings from the active scene will be used for all scenes. This is typically the first scene loaded unless you manually set it like below.

            SceneManager.SetActiveScene(SceneManager.GetSceneByName("Scene2"));

Some more details can be found at: https://docs.unity3d.com/ScriptReference/SceneManagement.LoadSceneMode.Additive.html https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.html

Upvotes: 2

Related Questions