Shortcut
A keybinding attached to the control it fires. Names either a rebindable action, so a rebind moves the key with it, or a literal chord like Ctrl+S for one that never changes.
On this page
Add it
+ Add node → Menu Button creates a node with it already on. Already have a node for it? Add component → ShortcutComponent.
From a script
A script on the same node writes these fields by name. ShortcutComponent is the name to pass.
rgs
set_text("ShortcutComponent", "action", "");
set_text("ShortcutComponent", "key", "");
set_flag("ShortcutComponent", "show_label", true); Fields
| Field | Script name | Kind | Default | What it does |
|---|---|---|---|---|
| Action | action | text | empty | Input action that fires this widget. |
| Key | key | text | empty | A key named literally, e.g. Ctrl+KeyS. |
| Show Label | show_label | checkbox | on | Whether the control draws its key inside its right edge, at half the size of its words. |