Skip to reading
GDScript Programming & Godot

SetObjectEnabled()

Edition 0.86.4.1 HF1

0.86.4.1 Hotfix 1 edition. Earlier lessons and screenshots retain their original version context; revised references and supplements describe the newer behavior.

Download PDFView PDF page

Enable / Disable Object

Set an object's enabled state.

Source table from SetObjectEnabled(), page 127
Option key / fieldMeaning and inputDefault
Room sceneIdChoose a scene ID.Blank
Object entityIdChoose an entity in the selected scene.Blank
Enabled enabledExplicit on/off state for the feature or response.true

Timing. Waits for the runtime routine to return; no further completion wait is promised by this schema.

Code example
await SetObjectEnabled({"sceneId": "lab", "entityId": "archive_door", "enabled": true})

In use. Disable a puzzle object while the scene is being prepared. Test its visual, input and collision behavior in the running game; use Set Object Visible when you only mean to change whether it is drawn.

SetObjectVisible()#

Hide / Unhide Object

Show or hide an object.

Source table from SetObjectEnabled(), page 127
Option key / fieldMeaning and inputDefault
Room sceneIdChoose a scene ID.Blank
Object entityIdChoose an entity in the selected scene.Blank
Visible visibleExplicit visible/hidden state.true

Timing. Waits for the runtime routine to return; no further completion wait is promised by this schema.

Code example
await SetObjectVisible({"sceneId": "lab", "entityId": "archive_door", "visible": true})

In use. Hide the workbench key after giving its inventory item. Hiding is not a collision-size editor or a substitute for disabling a trigger. For reusable pickup logic, target this in a script with an object caller.

Page 127 of 378Permalink
Go to page