private void OnDestroy()
 {
     if (s_Window != null)
     {
         s_Window = null;
     }
 }
 public static ColorChartEditorWindow OpenColorChartEditorWindow()
 {
     if (s_Window != null)
     {
         s_Window.Focus();
         return(s_Window);
     }
     s_Window = EditorWindow.GetWindow <ColorChartEditorWindow>(false, "Color Chart");
     s_Window.Show();
     return(s_Window);
 }
        public override void OnInspectorGUI()
        {
            DrawDefaultInspector();

            EditorGUILayout.Space();
            if (GUILayout.Button("Load Colors From Texture"))
            {
                string path = EditorUtility.OpenFilePanelWithFilters("Create Chart", "Assets", new string[] { "PNG Image", "png", "JPG Image", "jpg", "GIF Image", "gif" });
                if (!string.IsNullOrEmpty(path) && path.Contains(Application.dataPath))
                {
                    path = path.Replace(Application.dataPath, "Assets");
                    Texture2D texture = AssetDatabase.LoadAssetAtPath <Texture2D>(path);
                    ColorChart.LoadColorsFromTexture(chart, texture);
                }
            }

            if (GUILayout.Button("Open Edit Window"))
            {
                ColorChartEditorWindow window = ColorChartEditorWindow.OpenColorChartEditorWindow();
                window.src = chart;
            }
        }