Game Development Reference
In-Depth Information
The
Rect Transform
component is included with all Unity UI objects added to the
scene instead of the regular Transform component and forms a core part in the
layout of all
Unity UI
controls.
If you add a
Rect Transform
component to any GameObject,
it will automatically replace the
Transform
component. If you
remove the
Rect Transform
component it will revert back to the
standard
Transform
component.
With UI components, the
Rect Tool
also reacts to the control modifiers in the
toolbar, depending on what they are currently set to, as you can see in the following
screenshot there are two modifier buttons, each with two settings:
When you have the
Rect Tool
selected, these toggles behave as follows for a
UI component:
•
Center
: The central pivot point of the Rect selection area acts as an anchor;
holding the mouse down on it moves the Rect around the screen.
•
Pivot
: With this option active, holding the mouse down on the pivot
point of the selection Rect moves the pivot point around the object, thus
altering the pivot point for the object (the point at which the object is
rotated/scaled around).
•
Global
: When in global mode, the selection area for a Rect Transform
surrounds the entire object including any rotated space. If the Rect is rotated,
the selection area stays un-rotated and sizes up to encompass all the used
space by the Rect.
•
Local
: When in local mode, the selection area is tight to the Rect Transform
area with rotation; if rotated, the selection area is also rotated.
Remember, the
Pivot
point of a source image and the
Pivot
point
of the
Rect
Transform
are two separate things; altering the
Pivot
point of the
Rect Transform
does
not
alter the
Pivot
point of the
source sprite/image.