private void DrawHeader()
        {
            EditorGUILayout.BeginVertical("Box");
            {

                EditorGUILayout.BeginVertical("Box");
                {
                    EditorGUILayout.LabelField("Auto Generate:");

                    EditorGUILayout.BeginHorizontal();
                    {
                        Settings.GenerateSortingLayers = EditorGUILayout.Toggle("Sorting Layers", Settings.GenerateSortingLayers);
                        Settings.GenerateLayers = EditorGUILayout.Toggle("Layers", Settings.GenerateLayers);

                    }
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    {
                        Settings.GenerateTags = EditorGUILayout.Toggle("Tags", Settings.GenerateTags);
                        Settings.GenerateScenes = EditorGUILayout.Toggle("Scenes", Settings.GenerateScenes);

                    }
                    EditorGUILayout.EndHorizontal();

                    EditorGUILayout.BeginHorizontal();
                    {
                        Settings.GenerateBundleVersion = EditorGUILayout.Toggle("Bundle Version", Settings.GenerateBundleVersion);
                        Settings.GenerateBundleIdentifier = EditorGUILayout.Toggle("Bundle Identifer", Settings.GenerateBundleIdentifier);

                    }
                    EditorGUILayout.EndHorizontal();

                }
                EditorGUILayout.EndVertical();

                EditorGUILayout.BeginHorizontal("Box");
                {

                    if (GUILayout.Button("Generate Code", GUILayout.Height(40)))
                    {
                        if (!CheckForErrors())
                        {
                            EditorUtility.SetDirty(_settings);

                            AssetDatabase.SaveAssets();
                            AssetDatabase.Refresh();

                            ConstantsGeneratorEditor.GenerateConstantsCode(Settings);

                        }
                    }

                    if (GUILayout.Button("New Category", GUILayout.Height(40)))
                    {
                        ConstantCategory newCategory = new ConstantCategory();
                        newCategory.Name = "Unamed Category";
                        newCategory.Constants = new List<ConstantValuePair>();
                        newCategory.IsOpned = true;

                        Settings.Categories.Add(newCategory);
                    }

                    if (GUILayout.Button("Select Asset", GUILayout.Height(40)))
                    {
                        string[] assetsGuids = AssetDatabase.FindAssets("l:" + CONSTANTS_SETTINGS_ASSET_LABEL);
                        string assetPath = AssetDatabase.GUIDToAssetPath(assetsGuids[0]);
                        Object settingsAsset = AssetDatabase.LoadMainAssetAtPath(assetPath);

                        Selection.activeObject = settingsAsset;
                    }

                    if (GUILayout.Button("Select Output", GUILayout.Height(40)))
                    {
                        string[] assetsGuids = AssetDatabase.FindAssets(CONSTANTS_FILE_NAME);
                        string assetPath = AssetDatabase.GUIDToAssetPath(assetsGuids[0]);
                        Object generatedConstantsScript = AssetDatabase.LoadMainAssetAtPath(assetPath);

                        Selection.activeObject = generatedConstantsScript;
                    }

                }
                EditorGUILayout.EndHorizontal();

            }
            EditorGUILayout.EndVertical();
        }
        private ReorderableList ListForCategory(ConstantCategory category)
        {
            if (_listsCache.ContainsKey(category) && _listsCache[category] != null)
            {
                return _listsCache[category];
            }

            ReorderableList list = new ReorderableList(category.Constants, typeof(ConstantValuePair));

            list.drawElementCallback = (rect, index, active, focused) => {
                ConstantValuePair element = category.Constants[index];
                if (_errors != null && _errors.Contains((object)element))
                {
                    GUI.color = Color.red;
                }
                element.Key = EditorGUI.TextField(new Rect(rect.x, rect.y, rect.width * 0.3f, EditorGUIUtility.singleLineHeight), element.Key);
                element.ValueType = (eConstantValueType)EditorGUI.EnumPopup(new Rect(rect.x + rect.width * 0.32f, rect.y, rect.width * 0.12f, EditorGUIUtility.singleLineHeight), element.ValueType);

                Rect valueRect = new Rect(rect.x + rect.width * 0.46f, rect.y, rect.width * 0.5f, EditorGUIUtility.singleLineHeight);
                switch (element.ValueType)
                {
                    case eConstantValueType.String:
                        {
                            element.StringValue = EditorGUI.TextField(valueRect, element.StringValue);
                            break;
                        }
                    case eConstantValueType.Int:
                        {
                            element.IntValue = EditorGUI.IntField(valueRect, element.IntValue);
                            break;
                        }
                    case eConstantValueType.Float:
                        {
                            element.FloatValue = EditorGUI.FloatField(valueRect, element.FloatValue);
                            break;
                        }
                    case eConstantValueType.Color:
                        {
                            element.ColorValue = EditorGUI.ColorField(valueRect, element.ColorValue);
                            break;
                        }
                    case eConstantValueType.Vector3:
                        {
                            element.Vector3Value = EditorGUI.Vector3Field(valueRect, "", element.Vector3Value);
                            break;
                        }
                    case eConstantValueType.Vector2:
                        {
                            element.Vector2Value = EditorGUI.Vector2Field(valueRect, "", element.Vector2Value);
                            break;
                        }
                }

                GUI.color = Color.white;
            };

            list.drawHeaderCallback = rect => {
                EditorGUI.LabelField(new Rect(rect.x, rect.y, rect.width * 0.4f, EditorGUIUtility.singleLineHeight), "Key");
                EditorGUI.LabelField(new Rect(rect.x + rect.width * 0.42f, rect.y, rect.width * 0.5f, EditorGUIUtility.singleLineHeight), "Value");
            };

            list.onChangedCallback = changedList =>
            {
                EditorUtility.SetDirty(_settings);
            };

            _listsCache.Add(category, list);

            return list;
        }
        private void DrawCategory(ConstantCategory category)
        {
            EditorGUILayout.BeginVertical();
            {
                EditorGUILayout.BeginHorizontal("Box");
                {
                    if (category.IsOpned)
                    {
                        category.Name = EditorGUILayout.TextField(category.Name, GUILayout.Width(150));
                        GUILayout.FlexibleSpace();
                        if (GUILayout.Button("X", GUILayout.Width(25)))
                        {
                            _categoryToDelete = category;
                        }
                    }
                    else
                    {
                        EditorGUILayout.LabelField(category.Name);
                    }

                    if (GUILayout.Button(category.IsOpned ? "▲" : "▼", GUILayout.Width(25)))
                    {
                        category.IsOpned = !category.IsOpned;
                    }
                }
                EditorGUILayout.EndHorizontal();

                if (_errors != null && _errors.Contains((object)category))
                {
                    EditorGUILayout.HelpBox("Category '" + category.Name + "' already exists", MessageType.Error);
                }

                EditorGUILayout.BeginHorizontal();
                {
                    GUILayout.FlexibleSpace();

                    EditorGUILayout.BeginVertical(GUILayout.Width(position.width * 0.9f));
                    {

                        if (category.IsOpned)
                        {
                            ReorderableList list = ListForCategory(category);
                            //serializedObject.Update();
                            if (list != null)
                            {
                                list.DoLayoutList();
                            }
                            //serializedObject.ApplyModifiedProperties();
                        }
                    }
                    EditorGUILayout.EndVertical();

                    GUILayout.FlexibleSpace();
                }
                EditorGUILayout.EndHorizontal();
            }
            EditorGUILayout.EndVertical();
        }