Skip to main content

widget

ui · 12 properties · UI

A HUD element the widget layer draws every frame: a label, button or panel anchored to a screen corner or the center, offset in design pixels. A button records its click in clicked and calls the node's on_click method.

In a scene, widget is the node key that applies it. A script reaches the same properties through node.widget.get() and node.widget.set(table).

Properties

propertytypedefaultdescription
anchorenumtop_leftScreen corner or center the offset is measured from One of top_left, top_right, bottom_left, bottom_right, center.
clickedboolfalseTrue on the frame the button was clicked Read-only: engine output the inspector shows but never writes.
font_sizefloat16Text size in design pixels At least 6.
heightfloat0Panel height in design pixels; 0 sizes to content At least 0.
kindenumlabelThe HUD element the widget layer draws One of label, button, panel.
on_clickstringScript method called on this node when the button is clicked
textstringlabelLabel or button caption
text_colorcolor[0.933,0.945,0.957,1]Text color
visiblebooltrueDraw the widget; hidden widgets keep their state
widthfloat0Panel width in design pixels; 0 sizes to content At least 0.
xfloat16Horizontal offset from the anchor, in design pixels
yfloat16Vertical offset from the anchor, in design pixels