Skip to reading
GDScript Programming & Godot

AddAssetToScene()

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

Add Asset to Scene

Create a runtime scene entity using an imported asset.

Source table from AddAssetToScene(), page 134
Option key / fieldMeaning and inputDefault
Asset assetIdChoose an imported asset.Blank
New ID idText.Blank
Name nameText.Blank
XYZ positionDestination/placement coordinates as [X, Y, Z].[0.0, 0.0, 0.0]
Enabled enabledExplicit on/off state for the feature or response.true
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 AddAssetToScene({"assetId": "your_asset", "id": "", "name": "powered"})

In use. Spawn a lantern model at [1,0,-2] with a unique ID. Import and verify the asset first. Repeating the spawn is not the same as showing one existing lantern.

Page 134 of 378Permalink
Go to page