Example #1
0
        static void LoadSettings()
        {
            var settings = HierachySectionSetting.GetOrCreateSettings();

            autoSetEditorOnlyTag   = settings.AutoSetEditorOnlyTag;
            foregroundColor        = settings.ForegroundColor;
            backgroundColor        = settings.BackgroundColor;
            hilightForegroundColor = settings.HilightForegroundColor;
            hilightBackgroundColor = settings.HilightBackgroundColor;
        }
        public static SettingsProvider CreateMyCustomSettingsProvider()
        {
            var provider = new SettingsProvider("Project/HierachySection", SettingsScope.Project)
            {
                label      = "HierachySection",
                guiHandler = (searchContext) =>
                {
                    var settings = HierachySectionSetting.GetSerializedSettings();

                    if (settings == null)
                    {
                        return;
                    }

                    EditorGUILayout.PropertyField(settings.FindProperty("autoSetEditorOnlyTag"), new GUIContent("Auto set \" EditorOnly \" tag"));
                    EditorGUILayout.PropertyField(settings.FindProperty("foregroundColor"), new GUIContent("Foreground"));
                    EditorGUILayout.PropertyField(settings.FindProperty("backgroundColor"), new GUIContent("Background"));
                    EditorGUILayout.PropertyField(settings.FindProperty("hilightForegroundColor"), new GUIContent("Hilight Foreground"));
                    EditorGUILayout.PropertyField(settings.FindProperty("hilightBackgroundColor"), new GUIContent("Hilight Background"));

                    settings.ApplyModifiedProperties();

                    EditorGUILayout.Space();
                    EditorGUILayout.Space();

                    EditorGUILayout.BeginHorizontal();

                    if (GUILayout.Button("Use Default", GUILayout.MaxWidth(100)))
                    {
                        HierachySectionSetting.RemoveExistSetting();
                    }

                    if (GUILayout.Button("Refresh", GUILayout.MaxWidth(100)))
                    {
                        HierachySection.RefreshSectionPrompt();
                    }

                    EditorGUILayout.EndHorizontal();
                },
                keywords = new HashSet <string>(new[] { "ForegroundColor", "BackgroundColor", "HilightColor" })
            };

            return(provider);
        }