Version 2.1.0.0

Odin has a dedicated attribute overview with examples

PropertyRangeAttribute class

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)]
public sealed class PropertyRangeAttribute : Attribute, _Attribute

PropertyRange attribute creates a slider control to set the value of a property to between the specified range.

This is equivalent to Unity's Range attribute, but this attribute can be applied to both fields and property.

Inheritance
  • System.Object
  • System.Attribute
  • PropertyRangeAttribute
Example
The following example demonstrates how PropertyRange is used.

Constructors

PropertyRangeAttribute(Double, Double)
Creates a slider control to set the value of the property to between the specified range..
public PropertyRangeAttribute(double min, double max)
Parameters
System.Double min

The minimum value.

System.Double max

The maximum value.

PropertyRangeAttribute(Double, String)
Creates a slider control to set the value of the property to between the specified range..
public PropertyRangeAttribute(double min, string maxMember)
Parameters
System.Double min

The minimum value.

System.String maxMember

The name of a field, property or method to get the max value from.

PropertyRangeAttribute(String, Double)
Creates a slider control to set the value of the property to between the specified range..
public PropertyRangeAttribute(string minMember, double max)
Parameters
System.String minMember

The name of a field, property or method to get the min value from.

System.Double max

The maximum value.

PropertyRangeAttribute(String, String)
Creates a slider control to set the value of the property to between the specified range..
public PropertyRangeAttribute(string minMember, string maxMember)
Parameters
System.String minMember

The name of a field, property or method to get the min value from.

System.String maxMember

The name of a field, property or method to get the max value from.

Fields

Max
The maximum value.
public double Max
MaxMember
The name of a field, property or method to get the max value from.
public string MaxMember
Min
The minimum value.
public double Min
MinMember
The name of a field, property or method to get the min value from.
public string MinMember