Version 3.3.1.2

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)]
[Conditional("UNITY_EDITOR")]
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 maxGetter)
Parameters
System.Double min

The minimum value.

System.String maxGetter

A resolved string that should evaluate to a float value, and will be used as the max bounds.

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

A resolved string that should evaluate to a float value, and will be used as the min bounds.

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 minGetter, string maxGetter)
Parameters
System.String minGetter

A resolved string that should evaluate to a float value, and will be used as the min bounds.

System.String maxGetter

A resolved string that should evaluate to a float value, and will be used as the max bounds.

Fields

Max
The maximum value.
public double Max
MaxGetter
A resolved string that should evaluate to a float value, and will be used as the max bounds.
public string MaxGetter
Min
The minimum value.
public double Min
MinGetter
A resolved string that should evaluate to a float value, and will be used as the min bounds.
public string MinGetter