How to Unity

The Ultimate Guide to Unity UI Rect Transform

Unity UI Rect Transform is your friend

Daniele Quero, PhD
Geek Culture
Published in
5 min readJan 24, 2023

--

Similarly to other game objects in Unity, also UI elements have a transform component, but due to their intrinsically different nature, this transform is way different from the others.

Unity UI elements have a Rect Transform (Rect stands for rectangle). Let’s look at it.

Rect Transform of a UI Element

Position

The position (Pos) parameters are not quite the same as in a regular game object, in fact, they strictly depend on the choice you make with the top-left button, Anchors Presets.

The Anchor Presets drop-down menu

Anchor

A choice in this menu would move the white cross you can see on the scene, on the selected Unity UI element. This is its anchor point. In other words, once the anchor is set, let’s say in the top-left corner of the canvas, the position parameters measure the UI element position in terms of distances (x, y, z) from that point.

This leads to another, extremely interesting question:

How are these distances measured?

--

--

Daniele Quero, PhD
Geek Culture

A professional developer with passion for game developing and skill-growing. A former Nuclear Physics Researcher who changed his life to pursue his dreams