Verified Commit 17378372 authored by Sebastian Höffner's avatar Sebastian Höffner
Browse files

Loading scenes only if necessary.

parent 6e920ec3
...@@ -18,12 +18,12 @@ public class SceneController : MonoBehaviour ...@@ -18,12 +18,12 @@ public class SceneController : MonoBehaviour
public void Start() public void Start()
{ {
if (SceneManager.sceneCount == 1) if (!SceneManager.GetSceneByName(contextScene).isLoaded)
{ {
SceneManager.sceneLoaded += SimpleSceneLoaded; SceneManager.sceneLoaded += SimpleSceneLoaded;
SceneManager.LoadSceneAsync(contextScene, LoadSceneMode.Additive); SceneManager.LoadSceneAsync(contextScene, LoadSceneMode.Additive);
} }
if (!Application.isEditor) if (!Application.isEditor && !SceneManager.GetSceneByName("UI").isLoaded)
{ {
SceneManager.LoadSceneAsync("UI", LoadSceneMode.Additive); SceneManager.LoadSceneAsync("UI", LoadSceneMode.Additive);
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment