Spinner
Has versions for the int and float types.
Note
In case of TextMeshPro error IndexOutOfRangeException: Index was outside the bounds of the array you need to reduce the font size or increase RectTransform size.
Options
Interactable
boolUser can interact with this widget.
Value Min
int/floatMinimal value.
Value Max
int/floatMaximal value.
Step
int/floatStep of the value.
SpinnerValue
int/floatCurrent value.
Validation
SpinnerValidationValidate value on specified event.
OnKeyDownValue checked on every key down event.Some value ranges cannot processed correctly withOnKeyDownvalidation.For example2..10because to enter10you need to enter1and1is not valid value.OnEndInputValue checked when editing has ended.
ScrollMode
Spinner.ScrollModesChange the value on the mouse scroll.
IgnoreDo not change the value on the mouse scroll.
UpIncreaseIncrease the value on the mouse wheel up and decrease on the wheel down.
UpDecreaseDecrease the value on the mouse wheel up and increase on the wheel down.
AllowHold
boolChange value on button hold.
HoldStartDelay
floatDelay of hold in seconds to start change value.
HoldChangeDelay
floatDelay of hold in seconds between each change value.
Plus Button
ButtonAdvancedButton to increase value.
Minus Button
ButtonAdvancedButton to decrease value.
Events
onPlusClick
UnityEventonMinusClick
UnityEvent
Spinner Events
onValueChangeInt
UnityEvent<int>onEndEditInt
UnityEvent<int>
SpinnerFloat Options
Format
stringValue format.
Decimal Separators
char[]Decimal separators.
Number Style
NumberStylesStyle of the number.
SpinnerFloat Events
onValueChangeFloat
UnityEvent<float>onEndEditFloat
UnityEvent<float>
Set maximum
spinner.Max = 100;
Set minimun
spinner.Min = 0;
Set value
spinner.Value = 10;
Set step
spinner.Step = 1;
Get value
Debug.Log(spinner.Value);