Class Slider
- Namespace
- UILib.Components
- Assembly
- UILib.dll
A component which can be dragged between a lower and upper limit.
public class Slider : UIComponent
- Inheritance
-
Slider
- Inherited Members
Constructors
Slider(float, float, Direction)
Initializes a slider.
public Slider(float min = 0, float max = 1, Slider.Direction direction = Direction.LeftToRight)
Parameters
minfloatThe minimum value of this slider
maxfloatThe maximum value of this slider
directionSlider.DirectionThe increasing direction for this slider
Properties
background
The normal background color of the slider.
public Image background { get; }
Property Value
fill
The image which covers the slider's background as the value increases.
public Image fill { get; }
Property Value
handle
The slider's handle.
public Image handle { get; }
Property Value
onDeselect
Invokes listeners when this slider is deselected.
public UnityEvent onDeselect { get; }
Property Value
- UnityEvent
onSelect
Invokes listeners when this slider is selected.
public UnityEvent onSelect { get; }
Property Value
- UnityEvent
onSubmit
Invokes listeners when the value of this slider is submitted. This happens when the user stops holding the slider down.
public ValueEvent<float> onSubmit { get; }
Property Value
onValueChanged
Invokes listeners when the value of this slider changes. Passes the current value of the slider to listeners.
public ValueEvent<float> onValueChanged { get; }
Property Value
slider
The underlying Unity Slider.
public Slider slider { get; }
Property Value
- Slider
value
The current value of this slider.
public float value { get; }
Property Value
Methods
SetDirection(Direction)
Sets the direction of this slider.
public void SetDirection(Slider.Direction direction)
Parameters
directionSlider.DirectionThe direction to use
SetLimits(float, float)
Sets the limits for this slider.
public void SetLimits(float min, float max)
Parameters
SetSize(float, float)
Sets the size of this slider.
public override void SetSize(float width, float height)
Parameters
SetThisTheme(Theme)
Allows setting the theme of this slider.
This handles setting the theme specifically for this component, not its children. It's protected to allow overriding if you were to create a subclass.
In most cases, you'd probably want to use SetTheme(Theme) instead.
protected override void SetThisTheme(Theme theme)
Parameters
themeThemeThe theme to apply
SetValue(float)
Sets the current value of this slider.
public void SetValue(float value)
Parameters
valuefloatThe value to set
UseWholeNumbers(bool)
Sets this slider to use whole numbers
public void UseWholeNumbers(bool use = true)
Parameters
useboolWhether whole numbers should be used