Skip to content
EN

Interface: SceneNodeHandle ​

Properties ​

PropertyModifierTypeDescription
refpublicstringStable runtime ref. Prefab direct children use instance/child; the source-root uid is not part of the path. Old instance/sourceRootUid/... refs are not accepted.
uidpublicstring-
namepublicstring-
layerpublicstringNormalized layer id; defaults to default.
tagspublicreadonly string[]Normalized, sorted tag ids.
nodepublicSuitySceneNodeRaw document node data. Prefer the component/query methods.
signalsreadonlyNodeSignalsNode-local state provider facade (docs/130 S5); safe on invalid nodes.
parentpublicSceneNodeHandle | nullParent handle; null for top-level nodes and the scene root.
childrenpublicSceneNodeHandle[]Direct child handles.
scenepublicSceneInstanceOwning scene instance.
activeSelfreadonlybooleanTrue when this node's own active flag is not false.
activeInHierarchyreadonlybooleanTrue when this node and all ancestors are active.
vectorParts?publicMap<string, Container<ContainerChild>>Named suity.vector part containers (keyed by data-part or id).
prefab?publicPrefabInstanceInfoPresent when this node is a Prefab instance root.

Methods ​

hasLayer() ​

ts
hasLayer(layer): boolean;

Parameters ​

ParameterType
layerstring

Returns ​

boolean


hasTag() ​

ts
hasTag(tag): boolean;

Parameters ​

ParameterType
tagstring

Returns ​

boolean


setLayer() ​

ts
setLayer(layer): boolean;

Parameters ​

ParameterType
layerstring

Returns ​

boolean


setTags() ​

ts
setTags(tags): boolean;

Parameters ​

ParameterType
tagsreadonly string[]

Returns ​

boolean


setActive() ​

ts
setActive(active): SceneNodeHandle;

Sets this node's own active state (requires a mutable scene).

Parameters ​

ParameterType
activeboolean

Returns ​

SceneNodeHandle


getChildByName() ​

ts
getChildByName(name): SceneNodeHandle | null;

First direct child with this name (case-insensitive fallback).

Parameters ​

ParameterType
namestring

Returns ​

SceneNodeHandle | null


resolve() ​

ts
resolve(path): SceneNodeHandle | null;

Resolves a child path relative to this node, e.g. "Child/Grandchild". Each segment matches name exactly; duplicate names use the first child.

Parameters ​

ParameterType
pathstring

Returns ​

SceneNodeHandle | null


component() ​

ts
component(type): SuitySceneComponent | undefined;

Returns the first direct component of type, or undefined.

Parameters ​

ParameterType
typestring

Returns ​

SuitySceneComponent | undefined


getComponent() ​

ts
getComponent<T>(type): 
  | ComponentHandleFor<T>
  | undefined;

Returns the first component of type on this node only.

Type Parameters ​

Type Parameter
T extends string

Parameters ​

ParameterType
typeT

Returns ​

| ComponentHandleFor<T> | undefined


getComponentInChildren() ​

ts
getComponentInChildren<T>(type): 
  | ComponentHandleFor<T>
  | undefined;

Searches this node and its descendants for the first component of type.

Type Parameters ​

Type Parameter
T extends string

Parameters ​

ParameterType
typeT

Returns ​

| ComponentHandleFor<T> | undefined


getComponents() ​

ts
getComponents<T>(type): ComponentHandleFor<T>[];

Returns all components of type on this node and its descendants.

Type Parameters ​

Type Parameter
T extends string

Parameters ​

ParameterType
typeT

Returns ​

ComponentHandleFor<T>[]


addComponent() ​

ts
addComponent(component, componentRef?): SceneComponentHandle;

Adds component to this node and returns its component handle.

component requires type; optional role, asset, enabled and properties follow the engine catalog. Extra fields are passed through. Pass componentRef to choose a stable key; when omitted, the runtime generates one.

Parameters ​

ParameterType
componentSuitySceneComponent
componentRef?string

Returns ​

SceneComponentHandle


removeComponent() ​

ts
removeComponent(component): boolean;

Removes the given component handle; false when it is no longer attached.

Parameters ​

ParameterType
componentSceneComponentHandle

Returns ​

boolean


getComponentByRef() ​

ts
getComponentByRef(componentRef): 
  | SceneComponentHandle<Record<string, unknown>>
  | undefined;

Returns the component at componentRef, or undefined when it is missing.

Parameters ​

ParameterType
componentRefstring

Returns ​

| SceneComponentHandle<Record<string, unknown>> | undefined


addScript() ​

ts
addScript(script, componentRef?): SceneComponentHandle;

Adds a suity.script component and returns its handle.

Pass an asset UID string to mount a persisted script, or a script class / { runtimeKey, displayName } to mount a runtime script by key.

Parameters ​

ParameterType
scriptstring | ScriptClassLike
componentRef?string

Returns ​

SceneComponentHandle


componentView() ​

ts
componentView(type): unknown;

Engine view for a component (Sprite/Vector/Text/Image display), or null.

Parameters ​

ParameterType
typestring

Returns ​

unknown


components() ​

ts
components(): SuitySceneComponent[];

All direct components on this node.

Returns ​

SuitySceneComponent[]


resolveAsset() ​

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

Resolves an asset using this node's document aliases.

Parameters ​

ParameterType
refstring

Returns ​

Promise<ResolvedAsset | null>


container() ​

Call Signature ​

ts
container(): Container;

Engine view for this node (container plus internal visual layer).

Returns ​

Container

Call Signature ​

ts
container<T>(): T | null;
Type Parameters ​
Type ParameterDefault type
Tunknown
Returns ​

T | null


containerVisual() ​

Call Signature ​

ts
containerVisual(): Container;

Node visual layer (suity-visual). Recreated on node view refresh.

Returns ​

Container

Call Signature ​

ts
containerVisual<T>(): T | null;
Type Parameters ​
Type ParameterDefault type
Tunknown
Returns ​

T | null


destroy() ​

ts
destroy(): boolean;

Removes this runtime-added node and its subtree from a mutable scene. Returns false if the handle is already invalid.

Removal runs component onDestroy, removes adapter views, updates indexes and emits nodeRemoved. Initial document nodes are protected; use scene.removeNode(ref, { allowStatic: true }) when explicitly intended.

Returns ​

boolean

Suity 开发者文档 · API 由 TypeDoc 从声明文件生成