Rect Transform

The main component of the UGUI system is the Rect Transform. All other GameObjects have the basic Transform Component, but the Rect Transform works solely for the UGUI setup.

The Rect (short for rectangular) Transform is used to control the size and positioning of the UI elements in your Scene. Even in 3D space, all the UI elements are two-dimensional, so by using rectangular values for position and size, we can get a good idea of their look and placement. Figure 14.4 shows the Rect Transform for a Canvas GameObject.


Figure 14.4 The Rect Transform with 2D position spacing


By default, all UGUI components have a Rect Transform ...

Get Learning 2D Game Development with Unity®: A Hands-On Guide to Game Creation now with O’Reilly online learning.

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