Toggle
A checkbox: pressing it flips a value and reports the new one — full screen, subtitles, invert Y. When on, it draws the box smaller inside itself, or its On Texture in place of the Panel's picture. Goes under a Canvas.
On this page
Add it
+ Add node → Toggle creates a node with it already on. Already have a node for it? Add component → ToggleComponent.
From a script
A script on the same node writes these fields by name. ToggleComponent is the name to pass.
rgs
set_text("ToggleComponent", "action", "");
set_flag("ToggleComponent", "on", false);
set_flag("ToggleComponent", "disabled", false);
set_colour("ToggleComponent", "normal", vec4(0.2, 0.2, 0.24, 1.0));
set_colour("ToggleComponent", "hovered", vec4(0.3, 0.3, 0.36, 1.0));
set_colour("ToggleComponent", "pressed", vec4(0.12, 0.12, 0.15, 1.0));
set_colour("ToggleComponent", "check", vec4(0.85, 0.85, 0.9, 1.0));
set_number("ToggleComponent", "check_inset", 6.0); Fields
| Field | Script name | Kind | Default | What it does |
|---|---|---|---|---|
| Action | action | text | empty | Reported with the new value when this flips. |
| On | on | checkbox | off | Whether it is on. This is saved, unlike a button's pressed state, which is just what the pointer is doing right now. |
| Disabled | disabled | checkbox | off | Whether it accepts input. |
| Normal | normal | colour | #33333d | Tint when idle. |
| Hovered | hovered | colour | #4d4d5c | Tint under the pointer, or when focused. |
| Pressed | pressed | colour | #1f1f26 | Tint while held. |
| Check | check | colour | #d9d9e6 | Colour of the mark drawn inside when it is on. |
| Check Inset | check_inset | number, at least 0 | 6 | How far the check mark sits inside the edge of the box. |
| On Texture | on_texture | asset | none | Shown instead of the Panel's picture, and instead of the check mark, while this is on. |