Rect
Where a UI node sits inside its parent: an anchor and an offset per corner. Equal anchors pin a fixed-size box to a point; different ones stretch it with the parent. Needs a Canvas above it to be positioned at all.
On this page
Add it
+ Add node → Panel, Image, Label, Localized Label, Button, Menu Button, Toggle, Dropdown, Text Entry, Slider, Stack, Grid, Aspect Rect, Scroll View, Scrollbar, Modal, Popup Menu, Fade Group, Virtual Stick, Virtual Button creates a node with it already on. Already have a node for it? Add component → RectComponent.
From a script
A script on the same node writes these fields by name. RectComponent is the name to pass.
rgs
set_point("RectComponent", "anchor_min", vec2(0.0, 0.0));
set_point("RectComponent", "anchor_max", vec2(1.0, 1.0));
set_point("RectComponent", "offset_min", vec2(0.0, 0.0));
set_point("RectComponent", "offset_max", vec2(0.0, 0.0));
set_point("RectComponent", "pivot", vec2(0.5, 0.5)); Fields
| Field | Script name | Kind | Default | What it does |
|---|---|---|---|---|
| Anchor Min | anchor_min | two numbers (x, y), 0 to 1, step 0.01 | (0, 0) | Top-left anchor, as a fraction of the parent. |
| Anchor Max | anchor_max | two numbers (x, y), 0 to 1, step 0.01 | (1, 1) | Bottom-right anchor; differs from Anchor Min to stretch. |
| Offset Min | offset_min | two numbers (x, y) | (0, 0) | Offset of the top-left corner from Anchor Min, in UI units. |
| Offset Max | offset_max | two numbers (x, y) | (0, 0) | Offset of the bottom-right corner from Anchor Max, in UI units. |
| Pivot | pivot | two numbers (x, y), 0 to 1, step 0.01 | (0.5, 0.5) | The point within this box that counts as its position, (0,0) top-left to (1,1) bottom-right. |