Exemplo n.º 1
0
        static void ConditionalValueGUI(string searchContext)
        {
            EditorGUI.BeginChangeCheck();

            s_NumberWithSlider.value = SettingsGUILayout.SettingsSlider("Number With Slider", s_NumberWithSlider, 0, 10, searchContext);

            var foo = s_Foo.value;

            using (new SettingsGUILayout.IndentedGroup("Foo Class"))
            {
                EditorGUI.BeginChangeCheck();

                foo.intValue    = SettingsGUILayout.SearchableIntField("Int Value", foo.intValue, searchContext);
                foo.stringValue = SettingsGUILayout.SearchableTextField("String Value", foo.stringValue, searchContext);

                // Because FooClass is a reference type, we need to apply the changes to the backing repository (SetValue
                // would also work here).
                if (EditorGUI.EndChangeCheck())
                {
                    s_Foo.ApplyModifiedProperties();
                }
            }

            SettingsGUILayout.DoResetContextMenuForLastRect(s_Foo);

            if (EditorGUI.EndChangeCheck())
            {
                MySettingsManager.Save();
            }
        }
Exemplo n.º 2
0
        void OnGUI()
        {
            EditorGUI.BeginChangeCheck();

            m_ColorField = EditorGUILayout.ColorField("Color", m_ColorField);

            if (EditorGUI.EndChangeCheck())
            {
                MySettingsManager.Set <Color>(k_ColorInstanceFieldKey, m_ColorField);
            }
        }
Exemplo n.º 3
0
 void OnEnable()
 {
     m_ColorField = MySettingsManager.Get <Color>(k_ColorInstanceFieldKey);
 }