public SceneController( ISceneTransition transition, ISceneReference startScene) { _transition = transition; _currentScene = startScene; _loadingState = LoadingState.Idle; }
private static void DrawRemoveBuildSettingsButton(ISceneReference sceneReference) { using (new EditorGUI.DisabledScope(EditorBuildSettingsHelper.Contains(sceneReference.path) == false)) { if (GUILayout.Button("Remove")) { EditorBuildSettingsHelper.RemoveScene(sceneReference.path); } } }
private static void DrawAddBuildSettingsButton(Object sceneAsset, ISceneReference sceneReference) { using (new EditorGUI.DisabledScope(sceneAsset == null || EditorBuildSettingsHelper.Contains(sceneReference.path))) { if (GUILayout.Button("Add")) { EditorBuildSettingsHelper.AddScene(sceneReference.path); } } }
public IEnumerator OnLoadScene_InvokesSceneChangedAction() { var sceneToLoad = _testScenes.ReloadableTestScene; ISceneReference loadedScene = null; var sceneController = new SceneController(_transition, _testScenes.DefaultTestScene); sceneController.SceneChanged += scene => loadedScene = scene; yield return(sceneController.LoadScene(_testScenes.ReloadableTestScene)); Assert.AreEqual(sceneToLoad, loadedScene); }
private static void DrawOpenSceneButton(ISceneReference sceneReference) { if (GUILayout.Button("Open") == false) { return; } if (EditorSceneManager.SaveCurrentModifiedScenesIfUserWantsTo()) { EditorSceneManager.OpenScene(sceneReference.path); } }
/// <summary> /// Shortcut to <see cref="SceneManager.LoadSceneAsync(string,UnityEngine.SceneManagement.LoadSceneMode)"/> /// </summary> public static AsyncOperation LoadAsync(this ISceneReference sceneReference, LoadSceneMode mode = LoadSceneMode.Single) { if (sceneReference == null) { throw new ArgumentNullException(nameof(sceneReference)); } if (!sceneReference.IsValid) { throw new ArgumentException($"Probably scene asset reference is empty ({sceneReference}).", nameof(sceneReference)); } return(SceneManager.LoadSceneAsync(sceneReference.ScenePath, mode)); }
/// <summary> /// Shortcut to <see cref="SceneManager.LoadScene(string,UnityEngine.SceneManagement.LoadSceneMode)"/> /// </summary> public static void LoadSync(this ISceneReference sceneReference, LoadSceneMode mode = LoadSceneMode.Single) { if (sceneReference == null) { throw new ArgumentNullException(nameof(sceneReference)); } if (sceneReference.IsValid) { SceneManager.LoadScene(sceneReference.ScenePath, mode); } else { throw new ArgumentException($"Unable to load scene by reference. Reference is invalid. ({sceneReference}).", nameof(sceneReference)); } }
public IEnumerator LoadScene(ISceneReference scene) { _gameState.LoadingState.Value = GameState.LoadingStates.Loading; yield return(_transition.Show()); if (scene != _gameState.CurrentScene.Value) { yield return(UnLoadScene()); yield return(LoadScene(scene.SceneName)); _gameState.CurrentScene.Value = scene; } yield return(_transition.Hide()); _gameState.LoadingState.Value = GameState.LoadingStates.Idle; _gameEventBus.Fire(new SceneChangedEvent(scene)); }
private void DrawSceneReferenceMenu(ISceneReference sceneReference, string displayName, Color color) { var scene = AssetDatabase.LoadAssetAtPath <SceneAsset>(sceneReference?.ScenePath); DrawSceneAssetMenu(scene, displayName, color); }
public static AsyncOperation UnloadSceneAsync(this ISceneReference self, UnloadSceneOptions options = UnloadSceneOptions.None) { return(SceneManager.UnloadSceneAsync(self.path, options)); }
public static AsyncOperation LoadSceneAsync(this ISceneReference self, LoadSceneParameters parameters) { return(SceneManager.LoadSceneAsync(self.path, parameters)); }
public SceneChangedEvent(ISceneReference scene) { Scene = scene; }
public void SetDefaultSceneOverride(ISceneReference sceneReference) { _defaultSceneOverride = sceneReference; }
public static void LoadScene(this ISceneReference self, LoadSceneMode mode = LoadSceneMode.Single) { SceneManager.LoadScene(self.path, mode); }
public static SceneAsset FindSceneAsset(this ISceneReference self) { return(AssetDatabase.LoadAssetAtPath <SceneAsset>(self.path)); }
private void LoadScene(ISceneReference scene) { _coroutineRunner.StartCoroutine(_sceneController.LoadScene(scene)); }
public static Scene LoadScene(this ISceneReference self, LoadSceneParameters parameters) { return(SceneManager.LoadScene(self.path, parameters)); }
public static AsyncOperation LoadSceneAsync(this ISceneReference self, LoadSceneMode mode = LoadSceneMode.Single) { return(SceneManager.LoadSceneAsync(self.path, mode)); }
private static void OnSceneChanged(ISceneReference sceneReference) { Debug.Log($"Scene changed to {sceneReference.SceneName}"); }
public ChangeSceneEvent(ISceneReference scene) { Scene = scene; }