A reusable default canvas

Unity's UI canvas provides lots of options and parameters to accommodate the kinds of graphical layout flexibility that we have come to expect not only in games but also from web and mobile apps. With this flexibility comes additional complexity. To make our examples in this chapter easier, we'll first build a reusable prefab canvas that has our preferred default settings.

Create a new canvas and change its Render Mode to world space as follows:

  1. Navigate to GameObject | UI | Canvas
  2. Rename the canvas as DefaultCanvas
  3. Set Render Mode to World Space

The Rect Transform component defines the grid system on the canvas itself, like the lines on a piece of graph paper. It is used for the placement of UI elements on the ...

Get Unity Virtual Reality Projects - 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.