void OnDestroy() { inited = false; if (dirty && EditorUtility.DisplayDialog("There are unsaved changes that will be lost!", "Are you sure you want to close the window and lose usaved changes?", "Save it!", "Forget it...")) { Save(); } EditorInstances.liveInstance = null; EditorHelpers.ClearData(); }