void OnDisable() { _gui = null; _recordButton = null; _recordVideo = null; EditorApplication.playmodeStateChanged -= PlayModeStateChanged; }
void OnEnable() { InitializedPrefsIfNeeded(); _recordVideo = FindOrCreateRecordVideo(); _gui = new GUIVertical(); _gui.Add( new GUIButton( new GUIContent( FFmpegPathButtonText(), FFmpegPathButtonText()), PickFFmpegPathClicked)); _gui.Add( new GUIButton( new GUIContent( OutputFolderButtonText(), OutputFolderButtonText()), PickOutputFolderClicked)); _gui.Add( new GUIIntSlider( new GUIContent( "Super Size", "Frames will be rendered at this multiple of the current resolution"), _recordVideo.superSize, 1, 4, SuperSizeChanged)); _gui.Add( new GUIIntSlider( new GUIContent( "Framerate", "The fixed framerate of recorded video"), _recordVideo.captureFramerate, 10, 60, FramerateChanged)); _gui.Add( new GUIEnumPopup( new GUIContent( "Output Format"), (OutputFormat) EditorPrefs.GetInt( OutputFormatPrefsKey), OutputFormatChanged)); GUIToggle deleteFrames = _gui.Add( new GUIToggle( new GUIContent( "Delete Frames", "Delete all frames after compiling videos"), DeleteFramesChanged)) as GUIToggle; deleteFrames.isToggled = EditorPrefs.GetBool( DeleteFramesPrefsKey); _gui.Add( new GUISpace()); _gui.Add( new GUIEnumPopup( new GUIContent( "Record Hotkey", "The key that will toggle recording during play mode"), (KeyCode) EditorPrefs.GetInt( RecordHotkeyPrefsKey), RecordHotkeyChanged)); _recordButton = _gui.Add( new GUIButton( new GUIContent( "Record"), RecordClicked)) as GUIButton; _recordButton.isEnabled = EditorApplication.isPlaying; EditorApplication.playmodeStateChanged += PlayModeStateChanged; }