LayoutElement
Says how much room one child wants along its parent's axis, for a Stack sharing space by what each child asks for: the least it will accept, what it wants when there is room, and its share of whatever is left over. Goes under a Canvas.
On this page
Add it
+ Add node → Image creates a node with it already on. Already have a node for it? Add component → LayoutElement.
From a script
A script on the same node writes these fields by name. LayoutElement is the name to pass.
rgs
set_number("LayoutElement", "min", 0.0);
set_number("LayoutElement", "preferred", 48.0);
set_number("LayoutElement", "flexible", 0.0); Fields
| Field | Script name | Kind | Default | What it does |
|---|---|---|---|---|
| Min | min | number, at least 0 | 0 | Never shrunk below this, even if it overflows. |
| Preferred | preferred | number, at least 0 | 48 | What it wants when there is room, in UI units. |
| Flexible | flexible | number, at least 0 | 0 | Share of the leftover space; zero never grows. |