public void OnDestroy() { Undo.CollapseUndoOperations(this.m_ModalUndoGroup); if (this.m_ColorSlider) { UnityEngine.Object.DestroyImmediate(this.m_ColorSlider); } if (this.m_ColorBox) { UnityEngine.Object.DestroyImmediate(this.m_ColorBox); } if (this.m_RTexture) { UnityEngine.Object.DestroyImmediate(this.m_RTexture); } if (this.m_GTexture) { UnityEngine.Object.DestroyImmediate(this.m_GTexture); } if (this.m_BTexture) { UnityEngine.Object.DestroyImmediate(this.m_BTexture); } if (this.m_HueTexture) { UnityEngine.Object.DestroyImmediate(this.m_HueTexture); } if (this.m_SatTexture) { UnityEngine.Object.DestroyImmediate(this.m_SatTexture); } if (this.m_ValTexture) { UnityEngine.Object.DestroyImmediate(this.m_ValTexture); } if (this.m_AlphaTexture) { UnityEngine.Object.DestroyImmediate(this.m_AlphaTexture); } ColorPicker.s_SharedColorPicker = null; if (this.m_IsOSColorPicker) { OSColorPicker.Close(); } EditorApplication.update = (EditorApplication.CallbackFunction)Delegate.Remove(EditorApplication.update, new EditorApplication.CallbackFunction(this.PollOSColorPicker)); if (this.m_ColorLibraryEditorState != null) { this.m_ColorLibraryEditorState.TransferEditorPrefsState(false); } if (this.m_ColorLibraryEditor != null) { this.m_ColorLibraryEditor.UnloadUsedLibraries(); } EditorPrefs.SetInt("CPickerHeight", (int)base.position.height); }
public static void Show(GUIView viewToUpdate, Color col, bool showAlpha) { ColorPicker.get.m_DelegateView = viewToUpdate; ColorPicker.color = col; ColorPicker.get.m_OriginalColor = col; ColorPicker.get.m_ShowAlpha = showAlpha; ColorPicker.get.m_ModalUndoGroup = Undo.GetCurrentGroup(); if (ColorPicker.get.m_IsOSColorPicker) { OSColorPicker.Show(showAlpha); } else { ColorPicker get = ColorPicker.get; get.title = "Color"; float y = (float)EditorPrefs.GetInt("CPickerHeight", (int)get.position.height); get.minSize = new Vector2(193f, y); get.maxSize = new Vector2(193f, y); get.InitIfNeeded(); get.ShowAuxWindow(); } }