private void CancelRendering() { if (!_isRendering) { return; } var editor = Editor.Instance; // End rendering Editor.Log("Ending scene animation rendering"); FlaxEngine.Scripting.Update -= Tick; Time.SetFixedDeltaTime(false, 0.0f); Time.GamePaused = _wasGamePaused; if (_player) { _player.Stop(); _player.Parent = null; Object.Destroy(ref _player); } _window.Editor.StateMachine.CurrentState.UpdateFPS(); for (int i = 0; i < _stagingTextures.Length; i++) { _stagingTextures[i].Texture.ReleaseGPU(); Object.Destroy(ref _stagingTextures[i].Texture); } if (_progress != null) { _progress.End(); editor.ProgressReporting.UnregisterHandler(_progress); } if (_editorState != null) { editor.StateMachine.GoToState(editor.StateMachine.EditingSceneState); editor.StateMachine.RemoveState(_editorState); } // Update UI var gameWin = editor.Windows.GameWin; gameWin.Viewport.CustomResolution = null; gameWin.Viewport.BackgroundColor = Color.Transparent; gameWin.Viewport.KeepAspectRatio = false; gameWin.Viewport.Task.PostRender -= OnPostRender; _gameWindow = null; _isRendering = false; _presenter.Panel.Enabled = true; _presenter.BuildLayoutOnUpdate(); }