void Update() { if (!initialized) { return; } if (queuedActiveSceneSwitch != null && !IsCurrentlyLoadingScenes) { queuedActiveSceneSwitch.Invoke(); queuedActiveSceneSwitch = null; } }
/// <summary> /// Switches the active scene, loads the connected scenes as defined by worldGraph, and unloads all other currently loaded scenes. /// If we are currently loading already, queue up this scene change instead to be started once the previous one finishes. /// </summary> /// <param name="levelName">Name of the scene to become active</param> /// <param name="playBanner">Whether or not to play the LevelBanner. Defaults to true.</param> /// <param name="saveDeactivatedScenesToDisk">Whether or not to save any scenes that deactivated to disk. Defaults to true</param> /// <param name="loadActivatedScenesFromDisk">Whether or not to load any scenes from disk that become activated. Defaults to true</param> /// <param name="checkActiveSceneName">If true, will skip loading the scene if it's already the active scene. False will force it to load the scene. Defaults to true.</param> public void SwitchActiveScene( string levelName, bool playBanner = true, bool saveDeactivatedScenesToDisk = true, bool loadActivatedScenesFromDisk = true, bool checkActiveSceneName = true ) { if (IsCurrentlyLoadingScenes) { queuedActiveSceneSwitch = new QueuedSceneSwitch(levelName, playBanner, saveDeactivatedScenesToDisk, loadActivatedScenesFromDisk, checkActiveSceneName); } else { SwitchActiveSceneNow(levelName, playBanner, saveDeactivatedScenesToDisk, loadActivatedScenesFromDisk, checkActiveSceneName); } }
public LevelManagerSave(LevelManager levelManager) : base(levelManager) { this.initialized = levelManager.initialized; this.activeScene = levelManager.activeSceneName; this.queuedActiveSceneSwitch = levelManager.queuedActiveSceneSwitch; }