Skip to content

Interface: SceneInstance ​

Loaded scene instance.

The root Container belongs to the app. Add it to the stage, then query nodes and drive the runtime. getAll() includes expanded Prefab children.

Properties ​

PropertyModifierTypeDescription
rootpublicContainerScene root Container (label is suity-scene/suity-prefab).
documentpublicSuitySceneDocumentOriginal scene document (runtime instances are not written into it).
issuesreadonlyreadonly SceneIssue[]Validation/asset issues accumulated during load and runtime.
inputreadonlyInputStateScene input state: action definitions/bindings plus the frame snapshot.
mainCamerareadonlySceneNodeHandle | nullRuntime main camera (in-memory only; null when unset).

Methods ​

setMainCamera() ​

ts
setMainCamera(ref): SceneNodeHandle | null;

Sets the main camera by ref or uid; null clears it.

Parameters ​

ParameterType
refstring | null

Returns ​

SceneNodeHandle | null


getMainCameraView() ​

ts
getMainCameraView(viewportWidth, viewportHeight): CameraView | null;

Resolved main camera view for a viewport, or null when unavailable.

Parameters ​

ParameterType
viewportWidthnumber
viewportHeightnumber

Returns ​

CameraView | null


get() ​

ts
get(ref): SceneNodeHandle | null;

Looks up a node by: exact ref -> uid -> exact name -> case-insensitive name -> name path (Root/Child). Prefab direct children use instance/child; the legacy source-root path is not resolved.

Parameters ​

ParameterType
refstring

Returns ​

SceneNodeHandle | null


getByUid() ​

ts
getByUid(uid): SceneNodeHandle | null;

Looks up a node by uid; prefers top-level nodes when uids collide.

Parameters ​

ParameterType
uidstring

Returns ​

SceneNodeHandle | null


getAllByUid() ​

ts
getAllByUid(uid): SceneNodeHandle[];

All nodes with a uid (Prefab children can share document-scoped uids).

Parameters ​

ParameterType
uidstring

Returns ​

SceneNodeHandle[]


getAll() ​

ts
getAll(): SceneNodeHandle[];

All runtime nodes, including expanded Prefab child nodes.

Returns ​

SceneNodeHandle[]


getAllByName() ​

ts
getAllByName(name): SceneNodeHandle[];

Parameters ​

ParameterType
namestring

Returns ​

SceneNodeHandle[]


getChildByName() ​

ts
getChildByName(parentRef, name): SceneNodeHandle | null;

Finds a direct child of parentRef by name. parentRef: null targets the scene root. Exact names win over case-insensitive matches.

Parameters ​

ParameterType
parentRefstring | null
namestring

Returns ​

SceneNodeHandle | null


resolve() ​

ts
resolve(path): SceneNodeHandle | null;

Resolves a name path from the scene root, e.g. "Enemies/Boss/Weapon". Each segment matches name exactly; duplicate names use the first child. Empty paths and missing segments return null. Prefab paths start at the merged instance root; there is no source-root segment.

Parameters ​

ParameterType
pathstring

Returns ​

SceneNodeHandle | null


findByComponent() ​

ts
findByComponent(type): SceneNodeHandle[];

Parameters ​

ParameterType
typestring

Returns ​

SceneNodeHandle[]


findByLayer() ​

ts
findByLayer(layer): SceneNodeHandle[];

Finds nodes whose normalized layer equals layer (empty = default).

Parameters ​

ParameterType
layerstring

Returns ​

SceneNodeHandle[]


findByTag() ​

ts
findByTag(tag): SceneNodeHandle[];

Finds nodes containing the tag (case-insensitive).

Parameters ​

ParameterType
tagstring

Returns ​

SceneNodeHandle[]


findByTags() ​

ts
findByTags(query): SceneNodeHandle[];

Finds nodes matching all/any/none tag criteria.

Parameters ​

ParameterType
queryTagsQuery

Returns ​

SceneNodeHandle[]


findNodes() ​

ts
findNodes(query): SceneNodeHandle[];

Combined layer/tags/component/name/nodeKind query.

Parameters ​

ParameterType
queryNodeQuery

Returns ​

SceneNodeHandle[]


resolveAsset() ​

ts
resolveAsset(ref): Promise<ResolvedAsset | null>;

Resolves a document alias, Addressable Key or uid to a URL.

Parameters ​

ParameterType
refstring

Returns ​

Promise<ResolvedAsset | null>


loadTexture() ​

ts
loadTexture(ref): Promise<Texture<TextureSource<any>>>;

Loads a texture for a document alias / Addressable Key / uid.

Parameters ​

ParameterType
refstring

Returns ​

Promise<Texture<TextureSource<any>>>


on() ​

ts
on(event, handler): () => void;

Subscribes to a runtime event. Returns an unsubscribe function.

Parameters ​

ParameterType
eventSceneEvent
handler(payload) => void

Returns ​

() => void


instantiatePrefab() ​

ts
instantiatePrefab(options): Promise<SceneNodeHandle>;

Instantiates a Prefab into this scene.

Errors (all RuntimeSceneError with a code):

  • READ_ONLY: scene not loaded with { mutable: true }
  • ENGINE_NOT_AVAILABLE: no active engine catalog
  • PREFAB_NOT_FOUND, PREFAB_INVALID, PARENT_NOT_FOUND, ABORTED, UID_CONFLICT

Child asset failures emit assetMissing and do not abort instantiation.

Parameters ​

ParameterType
optionsInstantiatePrefabOptions & { cullArea?: NodeCullArea | null; }

Returns ​

Promise<SceneNodeHandle>


addNode() ​

ts
addNode(options): Promise<SceneNodeHandle>;

Adds a normal runtime node (requires mutable: true + engine catalog).

Parameters ​

ParameterType
optionsAddNodeOptions & { cullArea?: NodeCullArea | null; }

Returns ​

Promise<SceneNodeHandle>


reparentNode() ​

ts
reparentNode(
   ref, 
   parentRef, 
   options?
): SceneNodeHandle;

Moves a runtime node under another parent (or the scene root).

Parameters ​

ParameterType
refstring
parentRefstring | null
options?MoveNodeOptions

Returns ​

SceneNodeHandle


reorderNode() ​

ts
reorderNode(
   ref, 
   index, 
   options?
): SceneNodeHandle;

Reorders a runtime node among its current siblings.

Parameters ​

ParameterType
refstring
indexnumber
options?MoveNodeOptions

Returns ​

SceneNodeHandle


setComponent() ​

ts
setComponent(
   ref, 
   component, 
   componentRef?
): SceneNodeHandle;

Adds or replaces a component and runs the handler lifecycle.

Parameters ​

ParameterType
refstring
componentSuitySceneComponent
componentRef?string

Returns ​

SceneNodeHandle


removeNode() ​

ts
removeNode(ref, options?): boolean;

Removes a runtime node and its subtree (requires mutable: true).

Parameters ​

ParameterType
refstring
options?{ allowStatic?: boolean; }
options.allowStatic?boolean

Returns ​

boolean


removePrefabInstance() ​

ts
removePrefabInstance(ref): boolean;

Removes a runtime-instantiated Prefab and its expanded children. Returns false when the ref does not exist. Throws PREFAB_INVALID when the target is not a Prefab instance and READ_ONLY for read-only scenes.

Parameters ​

ParameterType
refstring

Returns ​

boolean


snapshot() ​

ts
snapshot(): RuntimeSceneSnapshot;

Read-only runtime-tree snapshot; never writes back to the scene document.

Returns ​

RuntimeSceneSnapshot


snapshotNode() ​

ts
snapshotNode(ref): RuntimeNodeSnapshot | null;

Parameters ​

ParameterType
refstring

Returns ​

RuntimeNodeSnapshot | null


flush() ​

ts
flush(): Promise<void>;

Waits for queued component writes and view refreshes.

Returns ​

Promise<void>


reloadPrefabInstance() ​

ts
reloadPrefabInstance(ref, options?): Promise<SceneNodeHandle>;

Reloads a Prefab instance from its source document, reapplies authored overrides, and discards runtime property changes.

Defaults preserve the instance transform and scene-owned children.

Parameters ​

ParameterType
refstring
options?{ preserveTransform?: boolean; preserveSceneChildren?: boolean; }
options.preserveTransform?boolean
options.preserveSceneChildren?boolean

Returns ​

Promise<SceneNodeHandle>


update() ​

ts
update(dt): void;

Advances component handlers and adapter node views. dt is in seconds.

Parameters ​

ParameterType
dtnumber

Returns ​

void


destroy() ​

ts
destroy(): void;

Destroys all runtime nodes, component handlers and engine views.

Returns ​

void

Suity developer documentation · API generated by TypeDoc