void OnPlaymodeChanged() { // detecting a start of the play mode if (!Application.isPlaying && EditorApplication.isPlayingOrWillChangePlaymode) InitializeRecorder(); Repaint(); }