17. Change a control during gameplay
Use the shared GUI actions when an element needs to change during play. Give an explicit GUI ID and element ID for these examples.
| Task | Action or property |
|---|---|
| Show/hide the whole panel | Show GUI / Hide GUI |
| Show/hide a particular control | Show GUI Element / Hide GUI Element |
| Keep a button visible but unavailable | Disable GUI Element; Enable GUI Element restores it. |
| Change a label or button caption | Change GUI Element Property: text |
| Fill or clear a text box | Change GUI Element Property: value |
| Change temporary hover artwork | Change GUI Element Property: hoverImageAssetId |
| Change one corner | Change GUI Element Property: radiusTopLeft, or the corresponding corner key. |
await ChangeGUIElementProperty({
"guiId": "register_panel",
"elementId": "register_feedback",
"property": "text",
"value": "The keeper has closed the register."
})If the feedback label originally contained $$feedback, replacing its text with this fixed sentence removes that token from the running element. Change the feedback variable instead when you want to preserve the live binding.
Runtime changes do not rewrite the saved authoring layout. Rebuilding a text box to change one of its definition properties can also replace its current draft. Store important entered text before an operation that recreates that control.
