static ToggleSceneViewFxOnPlayMode() { EditorApplication.playModeStateChanged += HandlePlayModeStateChange; EditorApplication.pauseStateChanged += HandlePauseStateChange; EditorApplication.projectChanged += TemporarilyDisableFx; controller = SceneViewFXController.instance; }
// On Pause, if we were maximized and the cachedEnableState is on, enable the SceneViewFX // On Unpause, if we were maximized and the SceneViewFX is on, cache their state and turn SceneViewFX off static void HandlePauseStateChange(PauseState pauseStatus) { if (GameWindow.instance.maximizeOnPlay && EditorApplication.isPlaying) { // Paused if (pauseStatus == PauseState.Paused) { controller = SceneViewFXController.instance; RestoreFxAsync(1500); } // Unpaused else { TemporarilyDisableFx(); } } }