Game Development Reference
In-Depth Information
To finish off, let's finalize the settings of
Rect Transform
for our
Slider
to position it
how we want it to be. You will also notice that because we are now using Stretched
Anchors, the
Rect Transform
position values have been updated to those shown in
the following screenshot:
Position values after stretching the health bar
Because the
Slider
GameObject is now has stretched
Anchors
on the
X
axis, the
Pos
X
and
Width
properties have been replaced with
Left
and
Right
. These now indicate
how much padding is there between the GameObject's
Rect Transform
border and
the left- and right-hand side areas of the screen.
If you set
Rect Transform
Anchors
to the
stretch
mode on
Y
axis,
the
Pos Y
and
Height
settings will be replaced with the top and
bottom settings instead. If you set it to stretch the area completely,
then all four settings will be updated.
If you now update the
Rect Transorm
values for the
Slider
with those shown in
the following screenshot, we will achieve the laudy goals our designer required,
well almost:
Updated position values