Canvas
Marks where an interface begins: on the surface for a HUD or menu, or in the room for a label over an enemy's head. Reference Size and Scale Mode decide how its units map onto the screen, and Use Safe Area keeps it clear of a notch.
On this page
Add it
+ Add node → Canvas creates a node with it already on. Already have a node for it? Add component → CanvasComponent.
From a script
A script on the same node writes these fields by name. CanvasComponent is the name to pass.
rgs
set_point("CanvasComponent", "reference_size", vec2(1280.0, 720.0));
set_flag("CanvasComponent", "use_safe_area", true); Fields
| Field | Script name | Kind | Default | What it does |
|---|---|---|---|---|
| Reference Size | reference_size | two numbers (x, y), at least 1 | (1280, 720) | The resolution this layout was designed at. |
| Scale Mode | scale_mode | one of ConstantPixel, ScaleWithWidth, ScaleWithHeight, ShrinkToFit | ScaleWithHeight | How the reference size maps onto the real surface. |
| Use Safe Area | use_safe_area | checkbox | on | Inset the canvas so a notch cannot cover it. |
| Space | space | one of Screen, World | Screen | Whether this subtree sits on the surface or stands in the room. |
| Layer | layer | number | 0 | Sort layer for a canvas in the room. Lower numbers draw first. |