private static void LoadEntrySceneOnPlayMode() { IEnumerable <SceneManagerController> controllers = Common.Editors.AssetDatabaseExtensions.GetAssetsOfType <SceneManagerController>(); playModeController = null; wasEntryOpened = false; SceneManagerController controllerToUse = controllers.FirstOrDefault((x) => x.useOnPlay); if (controllerToUse == null || controllerToUse.EntryScene == null) { return; } playModeController = controllerToUse; playModeController.ignoreEntryCall = true; SceneManager.sceneLoaded -= SceneManager_sceneLoaded; SceneManager.sceneLoaded += SceneManager_sceneLoaded; if (!SceneManagerExtensions.IsSceneLoadedByPath(controllerToUse.EntryScene.SceneAssetPath)) { SceneManager.LoadScene(controllerToUse.EntryScene.SceneName); } }
public void TransitionToEntry() { #if UNITY_EDITOR if (ignoreEntryCall) { return; } #endif // If no entry scene has been set, just try to find the current scene if (EntryScene == null) { SceneModel model = scenes.Find((x) => x.SceneAssetPath == SceneManager.GetActiveScene().path); ActiveScene = model; Evaluate(); return; } // Check if the scene is already active if (SceneManagerExtensions.IsSceneLoadedByPath(EntryScene.SceneAssetPath)) { ActiveScene = EntryScene; // it's already active, so do the starting evaluation Evaluate(); return; } TransitionToScene(EntryScene); }