Game Development Reference
In-Depth Information
There are a few things to note:
• The bottom left-hand corner of the Canvas in the scene starts at the position
of the topmost element in the project hierarchy, in this case, the fighter.
Just an observation: the Canvas is not actually linked to it. It's still a Screen
Space - Camera Canvas so its position doesn't really matter.
• The size of the Canvas will fluctuate based on the actual scene screen size.
Resize the scene view and watch the width and height update. If you recall
from the last chapter, this is something you need to watch out for, especially
with multi-resolution support (supporting your game on different resolutions).
• The layer of the new Canvas is automatically set to UI by default. You can
change this later if you wish. Remember this in your game if you are culling
certain layers from Camera views (just as the Camera for this Canvas will
only draw the UI layer, but we'll come to that in a minute).
• A new Render Camera option appears along with a Plane Distance option,
which we'll look at next.
• There is nothing to see here. This canvas has been left intentionally
blank (mainly because you haven't added anything to it yet, of course).
If you recall, in previous chapters, when you added a UI element to a scene,
it will have created a Canvas for you and then placed the new UI component
on it. We have just created the Canvas itself, so it's brand new, yet to
be unwrapped.
• An EventSystem was also added to the scene but you should have expected
this by now!
Right! It's time to put our health bar UI into action.
We won't be playing with the Canvas Scaler in this chapter as we
went through it in some depth in the previous one. Canvas Scalers
only really becomes important when you are deploying your title
and need to work with multiple resolutions. For this chapter, we are
concentrating on creating the UI and working with the Canvas itself.
(But don't let this stop you. Play with it as much as you like; it's your
game as well, you know!).
 
Search WWH ::




Custom Search