bool CancelSceneChange(NextScene scene, bool force) { if ((scene.IsLoadedLevel && !force) || (scene.Equals(nextScene) && !force)) { return(true); } if (transitionRunning) { Debug.LogError("A scene transition is already running!", this); return(true); } return(false); }
/// <summary> /// Loads the requested scene id. Use the force! uhm ... to reload a scene. /// </summary> public void LoadScene <T>(T scene, bool force) where T : NextScene { if (loadingScreenController != null && !loadingScreenController.IsInitialized) { loadingScreenController.Initialize(() => { LoadScene(scene, force); }); return; } if (CancelSceneChange(scene, force)) { return; } Debug.Log("Requested " + scene.ToString(), this); nextScene = scene; animateInDone = false; animateOutDone = false; StartCoroutine(SceneChangeCoroutine()); }
public void LoadScene(string sceneName) { var scene = new NextScene(sceneName); LoadScene <NextScene>(scene, false); }
/// <summary> /// Loads the scene with the given Index /// </summary> public void LoadScene(int sceneId) { var scene = new NextScene(sceneId); LoadScene <NextScene>(scene, false); }