Skip to reading
GDScript Programming & Godot

Nested properties and resource ownership

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
var door: Variant = Objects.Get("archive_door")
var effect: Dictionary = door.Get("shader", {}).duplicate(true)
effect["distortionAmount"] = 0.02
door.Set("shader", effect)

For an immediate supported nested effect update, use ChangeObjectProperty with property="shader.distortionAmount". Native Get/Set string paths avoid PCA Script’s separate dotted-path normalizer. A whole-container write can still require a rebuild depending on the target.

Custom is a custom-only child proxy. Get("custom.some_key") and Custom.Get("some_key") are different paths through the bridge, so use the custom-property setup appropriate to the record. Arrays should be copied and written back or edited through dedicated actions.

A native node is reached separately, for example through the guarded runtime entity_nodes lookup shown in the tutorial. A material/resource obtained from a rendered mesh may be shared by other meshes; a proxy’s ToDictionary does not duplicate loaded render resources.

Page 229 of 378Permalink
Go to page