17. Change a GUI from a script
Use Show GUI and Hide GUI when you only need visibility. Use Change GUI Element Property for a child control, and Change GUI Property for the window or a GUI custom property.
extends "res://scripts/runtime/script_base.gd"func run(_event: Dictionary = {}) -> Variant:
await ChangeGUIElementProperty({
"guiId": "adventure_hud",
"elementId": "hint_label",
"property": "text",
"value": "Ready to explore"
})
await ShowGUI({"guiId": "workshop_menu"})
return true1. Create a GDScript record using this source, with an ID such as update_hud.
2. Validate and apply the script, then save the project.
3. Call it from the desired GUI event using a script-running behavior/action, or from an existing action list.
4. In gameplay, check that Hint Label changes and Workshop Menu opens.
| Task | Action family |
|---|---|
| Show/hide a whole interface | Show GUI / Hide GUI |
| Show/hide one control or group | Show GUI Element / Hide GUI Element |
| Make a visible control unavailable | Disable GUI Element; use Enable GUI Element to restore it. |
| Change text, images, colors or geometry | Change GUI Element Property |
| Change a window appearance/custom value | Change GUI Property |
Runtime property changes affect the running interface. They do not rewrite the saved authoring layout. Keep starting values in the designer and use runtime actions for changes that happen during play.
