Namespace: | Sirenix.OdinInspector |
Assembly: | Sirenix.OdinInspector.Attributes |
[AttributeUsage(AttributeTargets.Assembly | AttributeTargets.Module | AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Constructor | AttributeTargets.Method | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Interface | AttributeTargets.Parameter | AttributeTargets.Delegate | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter | AttributeTargets.All, AllowMultiple = false, Inherited = true)]
[Conditional("UNITY_EDITOR")]
public class CustomValueDrawerAttribute : Attribute, _Attribute
public class CustomDrawerExamples : MonoBehaviour
{
public float From = 2, To = 7;
[CustomValueDrawer("MyStaticCustomDrawerStatic")]
public float CustomDrawerStatic;
[CustomValueDrawer("MyStaticCustomDrawerInstance")]
public float CustomDrawerInstance;
[CustomValueDrawer("MyStaticCustomDrawerArray")]
public float[] CustomDrawerArray;
#if UNITY_EDITOR
private static float MyStaticCustomDrawerStatic(float value, GUIContent label)
{
return EditorGUILayout.Slider(value, 0f, 10f);
}
private float MyStaticCustomDrawerInstance(float value, GUIContent label)
{
return EditorGUILayout.Slider(value, this.From, this.To);
}
private float MyStaticCustomDrawerArray(float value, GUIContent label)
{
return EditorGUILayout.Slider(value, this.From, this.To);
}
#endif
}
public CustomValueDrawerAttribute(string action)
System.String | action | A resolved string that defines the custom drawer action to take, such as an expression or method invocation. |
public string Action