Skip to reading
GDScript Programming & Godot

25. Read and change designer properties

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
Code example
func run() -> bool:
    var door: Variant = Objects.Get("archive_door")
    if door == null or not door.Exists():
        return false
    door.Set("visible", true)
    door.Set("transform.position", Vector3(2, 0, -3))
    return bool(door.Get("visible", false))

Get and Set accept a property path. Direct property syntax is convenient too, but Get can provide a fallback and can return an actual Dictionary instead of a nested proxy. Use that when you need to duplicate or edit container data.

Definition changes and live changes are different. A model or animation-state definition may need a loaded actor to rebuild. A live transform/visibility update can affect the current object immediately. The property reference marks that distinction.

Use record.Custom or a custom-only proxy for project-defined properties. Do not rename a record by assigning its ID. Edit an array copy and write the complete array back, or use a dedicated runtime action; a nested array mutation is not a reliable live notification.

The native Get/Set string-path route does not use PCA Script’s dotted-name canonicalizer. Use the full stored path for shader/particle fields rather than transplanting PCA Script’s special workaround unchanged.

Page 34 of 378Permalink
Go to page