Table of Contents

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

min float

The minimum value of this slider

max float

The maximum value of this slider

direction Slider.Direction

The increasing direction for this slider

Properties

background

The normal background color of the slider.

public Image background { get; }

Property Value

Image

fill

The image which covers the slider's background as the value increases.

public Image fill { get; }

Property Value

Image

handle

The slider's handle.

public Image handle { get; }

Property Value

Image

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

ValueEvent<float>

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

ValueEvent<float>

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

float

Methods

SetDirection(Direction)

Sets the direction of this slider.

public void SetDirection(Slider.Direction direction)

Parameters

direction Slider.Direction

The direction to use

SetLimits(float, float)

Sets the limits for this slider.

public void SetLimits(float min, float max)

Parameters

min float

The minimum value

max float

The maximum value

SetSize(float, float)

Sets the size of this slider.

public override void SetSize(float width, float height)

Parameters

width float

The width to set

height float

The height to set

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

theme Theme

The theme to apply

SetValue(float)

Sets the current value of this slider.

public void SetValue(float value)

Parameters

value float

The value to set

UseWholeNumbers(bool)

Sets this slider to use whole numbers

public void UseWholeNumbers(bool use = true)

Parameters

use bool

Whether whole numbers should be used