Exemple #1
0
        public override float GetPropertyHeight(MaterialProperty prop, string label, MaterialEditor editor)
        {
            float height;

            if (!MaterialToggleNoKeywordDrawer.IsPropertyTypeSuitable(prop))
            {
                height = 40f;
            }
            else
            {
                height = base.GetPropertyHeight(prop, label, editor);
            }
            return(height);
        }
Exemple #2
0
 public override void OnGUI(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor)
 {
     if (!MaterialToggleNoKeywordDrawer.IsPropertyTypeSuitable(prop))
     {
         EditorGUI.HelpBox(position, "Toggle used on a non-float property: " + prop.name, MessageType.Warning);
     }
     else
     {
         EditorGUI.BeginChangeCheck();
         bool flag = Mathf.Abs(prop.floatValue) > 0.001f;
         EditorGUI.showMixedValue = prop.hasMixedValue;
         flag = EditorGUI.Toggle(position, label, flag);
         EditorGUI.showMixedValue = false;
         if (EditorGUI.EndChangeCheck())
         {
             prop.floatValue = ((!flag) ? 0f : 1f);
         }
     }
 }