UnityEditor.MaterialEditor.DoPowerRangeProperty C# (CSharp) Method

DoPowerRangeProperty() static private method

static private DoPowerRangeProperty ( Rect position, MaterialProperty prop, string label, float power ) : float
position UnityEngine.Rect
prop MaterialProperty
label string
power float
return float
        internal static float DoPowerRangeProperty(Rect position, MaterialProperty prop, string label, float power)
        {
            EditorGUI.BeginChangeCheck();
            EditorGUI.showMixedValue = prop.hasMixedValue;
            float labelWidth = EditorGUIUtility.labelWidth;
            EditorGUIUtility.labelWidth = 0f;
            float num2 = EditorGUI.PowerSlider(position, label, prop.floatValue, prop.rangeLimits.x, prop.rangeLimits.y, power);
            EditorGUI.showMixedValue = false;
            EditorGUIUtility.labelWidth = labelWidth;
            if (EditorGUI.EndChangeCheck())
            {
                prop.floatValue = num2;
            }
            return prop.floatValue;
        }

Usage Example

 public override void OnGUI(Rect position, MaterialProperty prop, GUIContent label, MaterialEditor editor)
 {
     if (prop.type != MaterialProperty.PropType.Range)
     {
         GUIContent label2 = EditorGUIUtility.TempContent("PowerSlider used on a non-range property: " + prop.name, EditorGUIUtility.GetHelpIcon(MessageType.Warning));
         EditorGUI.LabelField(position, label2, EditorStyles.helpBox);
         return;
     }
     MaterialEditor.DoPowerRangeProperty(position, prop, label, this.power);
 }
MaterialEditor