public override void OnGUI(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor)
{
if (!IsPropertyTypeSuitable(prop))
{
GUIContent content = EditorGUIUtility.TempContent("Toggle used on a non-float property: " + prop.name, EditorGUIUtility.GetHelpIcon(MessageType.Warning));
EditorGUI.LabelField(position, content, EditorStyles.helpBox);
}
else
{
EditorGUI.BeginChangeCheck();
bool flag = Math.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;
this.SetKeyword(prop, flag);
}
}
}