Skip to content

Components

Grid

Arranges children in rows and columns — an inventory, a level select — where a Stack's one axis is not enough. Fit decides the column count: a fixed number, or as many fixed-size cells as fit the width. Goes under a Canvas.

On this page

Add it

+ Add node → Grid creates a node with it already on. Already have a node for it? Add component → GridComponent.

From a script

A script on the same node writes these fields by name. GridComponent is the name to pass.

rgs
set_point("GridComponent", "cell", vec2(64.0, 64.0));
set_point("GridComponent", "spacing", vec2(8.0, 8.0));
set_number("GridComponent", "padding", 0.0);

Fields

FieldScript nameKindDefaultWhat it does
Fitfitone of Columns, CellColumnsWhat decides the column count.
Columnscolumnsnumber, at least 14Only used by the Columns fit.
Cellcelltwo numbers (x, y)(64, 64)Cell size in UI units.
Spacingspacingtwo numbers (x, y), at least 0(8, 8)Gap between cells, in UI units.
Paddingpaddingnumber, at least 00Inset from the grid's own box on every side, in UI units.