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:

  1. 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.
  2. 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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.