private void OnSceneLoaded(Scene scene, LoadSceneMode mode) { SceneManager.SetActiveScene(scene); if (scene.name == mainSceneName) { expectedLoadingLevelName = string.Empty; SceneEvents.SceneLoaded(mainSceneName); } if (scene.name == expectedLoadingLevelName) { SceneEvents.SceneLoaded(expectedLoadingLevelName); expectedLoadingLevelName = string.Empty; if (SceneLoadedEvent != null) { SceneLoadedEvent(scene.name); } } }
private void OnSplashAnimationEnded(string timer) { bool isMainSceneAlreadyLoaded = false; for (var i = SceneManager.sceneCount - 1; i >= 0; i--) { var sceneName = SceneManager.GetSceneAt(i).name; if (sceneName.Equals(mainSceneName)) { isMainSceneAlreadyLoaded = true; break; } } if (isMainSceneAlreadyLoaded) { SceneEvents.SceneLoaded(mainSceneName); } else { SceneManager.LoadScene(mainSceneName, LoadSceneMode.Additive); } }