Game Development Reference
In-Depth Information
For the Slider, Unity provides by default:
• A grouping parent GameObject for the slider, with the
Slider
component attached
• A
Background
for the entire control (unlike the
Toggle
, which was just the
checkbox area)
• An empty GameObject used to provide a
Rect Transform
area for the
Slider
bar, with a child
Image
to fill the area using a default built-in sprite, the area
is filled based on the
Value
property of the
Slider
• An empty GameObject used to provide a Rect Transform area for the sliding
handle and a child
Image
to denote the
Handle
itself
As we look to the
Slider
control itself, we see that these two lower child elements are
the key parts of the
Slider
. However, their parent is just as important as it provides
the bounds of how far the
Slider
can travel:
Again, we see the familiar base controls of the
Selectable
and
UnityEvent
controls, this
time it is the
On Vaue Changed
event but with a data type of single (basically a float).