Slider
The Slider class is a component which interacts with Unity Sliders on UI.
caution
The Slider class is only compatible with TextMeshPro.
To get a Slider from an item, use the GetComponent method.
let sliderComponent = item.GetComponent("Slider")
You can then use the sliderComponent property to access the Slider class.
Methods
| Method Name | Return Type | Parameters | Description |
|---|---|---|---|
| GetValue | float | none | Gets the current slider value |
| SetValue | void | float | Sets the current slider value |
| RegisterValueChanged | void | function(float) | Registers an event for when the slider value is changed |
| RemoveAllValuesChanged | void | none | Removes all events for when the slider value is changed |
| GetMinimum | float | none | Gets the current minimum value for the slider |
| GetMaximum | float | none | Gets the current maximum value for the slider |
| SetRange | void | float, float | Sets the minimum and then maximum range for the slider |
| GetColorBlock | ColorBlock? | none | Gets the ColorBlock for the element |
| SetColorBlock | void | ColorBlock | Sets the ColorBlock for the element |
Properties
| Property Name | Type | Description |
|---|---|---|
| Enabled | bool | Checks the active state of the component |