The canvas

On creating a canvas object, you can now build a user interface. First, let's fix the resolution of our game to 16:9 from the Game tab. This will be important to preview the UI in screen space at an appropriate aspect ratio. To do this, switch to the Game tab and choose 16:9 as the screen aspect ratio:

Setting aspect ratio

Now, select the canvas object. From the object Inspector, set the Render Mode to Screen Space - Overlay, via the Canvas component, if this mode is not already selected. In this mode, the UI on the selected canvas appears on top of everything, literally. It is the highest rendered object and needs no camera for ...

Get Mastering Unity 2017 Game Development with C# - Second Edition 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.