public void RequestLoadScene (string sceneName, bool activateWhenReady) { var task = new SceneControlTask (); task.SceneName = sceneName; task.SceneControlMode = ESceneControlMode.Load; task.ActivateWhenReady = activateWhenReady; m_taskQueue.Enqueue (task); }
public void RequestUnloadScene (string sceneName) { var task = new SceneControlTask (); task.SceneName = sceneName; task.SceneControlMode = ESceneControlMode.Unload; task.ActivateWhenReady = true; m_taskQueue.Enqueue (task); }
private IEnumerator SceneUnloadCoroutine (SceneControlTask task) { var sceneName = task.SceneName; var async = SceneManager.UnloadSceneAsync (sceneName); async.allowSceneActivation = task.ActivateWhenReady; OnUnloadStartEventDictionary.GetEvent (sceneName).Invoke (); while (async.isDone == false) { float progress = async.progress; OnUnloadingEventDictionary.GetEvent (sceneName).Invoke (progress); yield return null; } }
private IEnumerator SceneLoadCoroutine (SceneControlTask task) { var sceneName = task.SceneName; var async = SceneManager.LoadSceneAsync (sceneName, LoadSceneMode.Additive); async.allowSceneActivation = task.ActivateWhenReady; OnLoadStartEventDictionary.GetEvent (sceneName).Invoke (); while (async.isDone == false) { float progress = async.progress; bool bReady = progress >= 0.9f; OnLoadingEventDictionary.GetEvent (sceneName).Invoke (progress, bReady); yield return null; } OnLoadEndEventDictionary.GetEvent (sceneName).Invoke (); }