Game Development Reference
In-Depth Information
Figure 17.5 Settings for
HealthLabel.
Step 7: Create a GUIText object (GameObject>Create Other>GUI Text).
Label it HealthLevel . Set the Transform Position to X = 0.5, Y = 1 , and
Z = 2. Set the text to read 0. Change the Anchor to “upper center.” Change
the Alignment to “center.” Change the Pixel Offset Y = -30 and assign a
font you like ( Figure 17.6 ).
Figure 17.6 Settings for HealthLevel
GUIText.
Why?
So this GUIText is set at the top center of the screen (Transform Position
(0.5, 1, 2)) and is aligning the text center and using as its anchor the upper
center. Then we're sliding it down 30 pixels off the top of the screen. Note
that the Z = 2 makes sure that the text is drawn on top of the HealthBG.
Step 8: Make both of these children of the GUIElements prefab in the
Hierarchy.
Step 9: Select GUIElements and press Prefab Apply.
Search WWH ::




Custom Search