Working with buttons and anchors
Now that we have the health bars working, let's tackle something similar to what we did before, in creating a simple HUD with a reset button. We'll also learn how to make our things look great at any resolution. We will need to perform the following steps:
- Let's start off with creating yet another canvas by navigating to GameObject | UI | Canvas. In this case, we want this canvas to cover our entire screen no matter which camera we are using, so this time we will keep the Render Mode property at Screen Space – Overlay. In order to differentiate from our last one, I will rename the canvas game object to
HUD
. - With the HUD object selected, next we will create a button by navigating to GameObject | UI | Button.
If we ...
Get Unity Game Development Blueprints now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.