Game Development Reference
In-Depth Information
If we look deeper into the properties of the
Slider
, we can see the following:
•
Fill Rect
: This provides the graphical range for the
Slider
control, it
translates the
Min
and
Max
values into graphical components on the
Canvas
. This is also Selectable to allow the user to jump to a position
in the
Slider
range.
•
Handle Rect
: This provides the grabble handle for the user to drag the
Slider
through its range and also provides input to the
Fill Rect
for
range calculations.
•
Direction
: This allows you to define the default direction of travel for the
slider in either horizontal or vertical directions (no diagonal sadly, but you
can always rotate the control J), giving you
left to right
or
right to left
options
for example.
Note: You will have to resize the control if you want to switch from
horizontal to vertical and vice-versa.
You don't rotate the control to switch from horizontal to vertical as it
messes with the settings the control uses to render the control.
•
Min
and
Max
Values
: This is the minimum and maximum values the
Slider
can range to, nothing more, nothing less.
•
Whole Numbers
: Given the base data type of the
Slider
is a
float
, it allows
for fine incremental changes. However, there are those situations where you
only need whole numbers or steps. Setting this option will cause the handle
and the
Slider
value to jump up in increments, say for selecting pages/tabs
on a form.
•
Value
: The all-important default value for the
Slider
, restricted to the
Min
and
Max
values you have set previously.
And that's all she wrote, there really isn't anything more fancy about the
Slider
,
it just does exactly what it says on the tin. As with the other controls/components,
you aren't restricted by Unity's default layout (the images don't even need to be
visible), go wild and see what options you can come up with, slip slide away.