public void SceneLoadedCallBack(object sender, SceneLoadedEvent showSceneEvent) { if (m_loadedSceneEvent != null) { foreach (callback call in m_loadedSceneEvent) { call?.Invoke(); } m_loadedSceneEvent.Clear(); } }
IEnumerator LoadScene(string _scene, bool _showLoadingScreen, string _unloadScene) { Application.backgroundLoadingPriority = ThreadPriority.Low; if (_showLoadingScreen == true && loadingMenuClasifier != null) { MenuManager.Instance.showMenu(loadingMenuClasifier); } yield return(new WaitForSeconds(delayTimer)); AsyncOperation _sync = null; if (_unloadScene != "") { _sync = SceneManager.UnloadSceneAsync(_unloadScene); while (_sync.isDone == false) { yield return(null); } _sync = Resources.UnloadUnusedAssets(); while (_sync.isDone == false) { yield return(null); } } if (currentLoadedScene != "" && SceneManager.GetSceneByName(currentLoadedScene).isLoaded) { _sync = SceneManager.UnloadSceneAsync(currentLoadedScene); while (_sync.isDone == false) { yield return(null); } _sync = Resources.UnloadUnusedAssets(); while (_sync.isDone == false) { yield return(null); } } yield return(new WaitForSeconds(delayTimer)); _sync = SceneManager.LoadSceneAsync(_scene, LoadSceneMode.Additive); while (_sync.isDone == false) { yield return(null); } yield return(new WaitForSeconds(delayTimer)); Scene loadedScene = SceneManager.GetSceneByName(_scene); if (loadedScene != null && loadedScene.buildIndex != -1) { UnityEngine.SceneManagement.SceneManager.SetActiveScene(loadedScene); } //else //{ // throw new System.Exception("Scene not found in Scene Manager: " + _scene); //} currentLoadedScene = _scene; SceneLoadedEvent _event = new SceneLoadedEvent(); EventManager.Instance.Raise(_event); if (_showLoadingScreen == true && loadingMenuClasifier != null) { MenuManager.Instance.hideMenu(loadingMenuClasifier); } Application.backgroundLoadingPriority = ThreadPriority.Normal; }
public virtual void SceneLoaded(object sender, SceneLoadedEvent showSceneEvent) { }
public void OnSceneLoadedCallBack(SceneLoadedEvent _e) { }