void OnDisable() { m_state.Dispose(); // Debug.Log("OnDisable"); Selection.selectionChanged -= Repaint; Undo.willFlushUndoRecord -= Repaint; // m_metaEditor UnityEditor.Editor.DestroyImmediate(m_metaEditor); m_metaEditor = null; // m_settingsInspector UnityEditor.Editor.DestroyImmediate(m_settingsInspector); m_settingsInspector = null; // m_meshesInspector UnityEditor.Editor.DestroyImmediate(m_meshesInspector); m_meshesInspector = null; // Meta Meta = null; ScriptableObject.DestroyImmediate(m_tmpMeta); m_tmpMeta = null; // m_settings ScriptableObject.DestroyImmediate(m_settings); m_settings = null; // m_meshes ScriptableObject.DestroyImmediate(m_meshes); m_meshes = null; }