private void HandlePlayModeStateChanged()
        {
#if DEBUG_QUEST_EDITOR
            Debug.Log("<color=magenta>QuestEditorWindow.OnPlaymodeStateChanged. Application.isPlaying=" + Application.isPlaying + "</color>");
#endif
            SelectQuestBasedOnCurrentSelection();
            QuestEditorStyles.ResetImages(); // Unity loses dynamically-created textures when switching playmode.
            QuestEditorPrefs.SavePrefs();
            Repaint();
        }
        private void OnDisable()
        {
#if DEBUG_QUEST_EDITOR
            Debug.Log("<color=red>QuestEditorWindow.OnDisable</color>");
#endif
            m_instance = null;
            QuestEditorPrefs.SavePrefs();
            Undo.undoRedoPerformed -= Repaint;
#if UNITY_5 || UNITY_2017_1
            EditorApplication.playmodeStateChanged -= OnPlaymodeStateChanged;
#else
            EditorApplication.playModeStateChanged -= OnPlayModeStateChanged;
#endif
        }