void OnDestroy() { if (_editing) { if (_saveOnClose) { RestoreObjects(); } else { Reset(); } } else { Reset(); } SaveEditorPrefs(); // Save MeshEdit preferences _i = null; // Free up the static instance }
static void Init() { if (_i == null) { UpdateGUIStyles(); _i = CreateInstance <MeshEdit>(); // Assign the static instance _i.titleContent = new GUIContent("MeshEdit"); // Set title, else we get the namespace too TryGetEditorPrefs(); // Get MeshEdit preferences; set defaults if not found _i.ShowUtility(); // Make it an undockable window FindVertPrefab(); if (_editOnOpen) { _i.CheckSelected(); _i.DissolveObjects(); } } else { _i.Close(); } }