Version 3.3.1.2

Odin has a dedicated attribute overview with examples

MinMaxSliderAttribute 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 MinMaxSliderAttribute : Attribute, _Attribute

Draw a special slider the user can use to specify a range between a min and a max value.

Uses a Vector2 where x is min and y is max.

Inheritance
  • System.Object
  • System.Attribute
  • MinMaxSliderAttribute
Example

The following example shows how MinMaxSlider is used.

public class Player : MonoBehaviour
{
	[MinMaxSlider(4, 5)]
	public Vector2 SpawnRadius;
}

Constructors

MinMaxSliderAttribute(Single, Single, Boolean)
Draws a min-max slider in the inspector. X will be set to min, and Y will be set to max.
public MinMaxSliderAttribute(float minValue, float maxValue, bool showFields = false)
Parameters
System.Single minValue

The min value.

System.Single maxValue

The max value.

System.Boolean showFields

If true number fields will drawn next to the MinMaxSlider.

MinMaxSliderAttribute(Single, String, Boolean)
Draws a min-max slider in the inspector. X will be set to min, and Y will be set to max.
public MinMaxSliderAttribute(float minValue, string maxValueGetter, bool showFields = false)
Parameters
System.Single minValue

The min value.

System.String maxValueGetter

A resolved string that should evaluate to a float value, which is used as the max bounds.

System.Boolean showFields

If true number fields will drawn next to the MinMaxSlider.

MinMaxSliderAttribute(String, Boolean)
Draws a min-max slider in the inspector. X will be set to min, and Y will be set to max.
public MinMaxSliderAttribute(string minMaxValueGetter, bool showFields = false)
Parameters
System.String minMaxValueGetter

A resolved string that should evaluate to a Vector2 value, which is used as the min/max bounds. If this is non-null, it overrides the behaviour of the MinValue, MinValueGetter, MaxValue and MaxValueGetter members.

System.Boolean showFields

If true number fields will drawn next to the MinMaxSlider.

MinMaxSliderAttribute(String, Single, Boolean)
Draws a min-max slider in the inspector. X will be set to min, and Y will be set to max.
public MinMaxSliderAttribute(string minValueGetter, float maxValue, bool showFields = false)
Parameters
System.String minValueGetter

A resolved string that should evaluate to a float value, which is used as the min bounds.

System.Single maxValue

The max value.

System.Boolean showFields

If true number fields will drawn next to the MinMaxSlider.

MinMaxSliderAttribute(String, String, Boolean)
Draws a min-max slider in the inspector. X will be set to min, and Y will be set to max.
public MinMaxSliderAttribute(string minValueGetter, string maxValueGetter, bool showFields = false)
Parameters
System.String minValueGetter

A resolved string that should evaluate to a float value, which is used as the min bounds.

System.String maxValueGetter

A resolved string that should evaluate to a float value, which is used as the max bounds.

System.Boolean showFields

If true number fields will drawn next to the MinMaxSlider.

Fields

MaxValue
The hardcoded max value for the slider.
public float MaxValue
MaxValueGetter
A resolved string that should evaluate to a float value, which is used as the max bounds.
public string MaxValueGetter
MinMaxValueGetter
A resolved string that should evaluate to a Vector2 value, which is used as the min/max bounds. If this is non-null, it overrides the behaviour of the MinValue, MinValueGetter, MaxValue and MaxValueGetter members.
public string MinMaxValueGetter
MinValue
The hardcoded min value for the slider.
public float MinValue
MinValueGetter
A resolved string that should evaluate to a float value, which is used as the min bounds.
public string MinValueGetter
ShowFields
Draw float fields for min and max value.
public bool ShowFields