Game Development Reference
In-Depth Information
4. Set the
Target Graphic
of the
Slider
to the
Fill
GameObject
by either using
the
Object Selector
button to the right of the property or dragging the
Fill
GameObject
from the hierarchy to the property. (This is just so when the
user's mouse hovers over the control it will be highlighted; this is optional).
5. Set the Slider
Width
property to
200
.
6. Set the Slider
Height
property to
25
.
7. Select the
Background GameObject in the Hierarchy
and set the
Color
property of the Image to
Black
(the slider background).
8. (optional) Resize the
Rect Transform
of the
Background
GameObject to fill
the area of the
Slider
GameObject).
9. Select the Slider again and set the
Max Value
property to
100
.
10. Check the box for
Whole Numbers
on the
Slider
.
11. Select the
Fill GameObject
in the project hierarchy and set the
Color
property of the image to
Green
. (Green is good for health, isn't it?)
12. (optional) Resize the
Rect Transform
of the
FillArea
GameObject to fill the
area of the
Slider
GameObject).
A screenshot showing the health bar Slider with its value at 80 (80%)