UnityEditor.MaterialKeywordEnumDrawer.OnGUI C# (CSharp) Method

OnGUI() public method

public OnGUI ( Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor ) : void
position UnityEngine.Rect
prop MaterialProperty
label UnityEngine.GUIContent
editor MaterialEditor
return void
        public override void OnGUI(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor)
        {
            if (!IsPropertyTypeSuitable(prop))
            {
                GUIContent content = EditorGUIUtility.TempContent("KeywordEnum used on a non-float property: " + prop.name, EditorGUIUtility.GetHelpIcon(MessageType.Warning));
                EditorGUI.LabelField(position, content, EditorStyles.helpBox);
            }
            else
            {
                EditorGUI.BeginChangeCheck();
                EditorGUI.showMixedValue = prop.hasMixedValue;
                int floatValue = (int) prop.floatValue;
                floatValue = EditorGUI.Popup(position, label, floatValue, this.keywords);
                EditorGUI.showMixedValue = false;
                if (EditorGUI.EndChangeCheck())
                {
                    prop.floatValue = floatValue;
                    this.SetKeyword(prop, floatValue);
                }
            }
        }