Skip to content

Components

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

FieldScript nameKindDefaultWhat it does
Reference Sizereference_sizetwo numbers (x, y), at least 1(1280, 720)The resolution this layout was designed at.
Scale Modescale_modeone of ConstantPixel, ScaleWithWidth, ScaleWithHeight, ShrinkToFitScaleWithHeightHow the reference size maps onto the real surface.
Use Safe Areause_safe_areacheckboxonInset the canvas so a notch cannot cover it.
Spacespaceone of Screen, WorldScreenWhether this subtree sits on the surface or stands in the room.
Layerlayernumber0Sort layer for a canvas in the room. Lower numbers draw first.