Repository navigation
API Class GameObject
Defined in: src/engine/scene/GameObject.ts:30
A node in the scene graph (ADR 0008). A lightweight handle to an internal entity; game code
never sees the entity id. Handles become invalid once the node is destroyed (at the end of
the frame destroy was called in).
get active(): boolean;Defined in: src/engine/scene/GameObject.ts:103
The node's own active flag.
boolean
get activeInHierarchy(): boolean;Defined in: src/engine/scene/GameObject.ts:107
Active only if this node and all its ancestors are active.
boolean
get children(): GameObject[];Defined in: src/engine/scene/GameObject.ts:136
GameObject[]
get id(): string;Defined in: src/engine/scene/GameObject.ts:93
Stable id from scene data (empty for nodes created at runtime).
string
get isComponentNode(): boolean;Defined in: src/engine/scene/GameObject.ts:110
True for component nodes: child nodes that host components on behalf of their parent (ADR 0009).
boolean
get isSceneNode(): boolean;Defined in: src/engine/scene/GameObject.ts:112
boolean
get isValid(): boolean;Defined in: src/engine/scene/GameObject.ts:84
False once the node has been destroyed.
boolean
get name(): string;Defined in: src/engine/scene/GameObject.ts:95
string
set name(value): void;Defined in: src/engine/scene/GameObject.ts:96
string
void
get parent(): GameObject | null;Defined in: src/engine/scene/GameObject.ts:130
GameObject | null
get scene(): GameObject | null;Defined in: src/engine/scene/GameObject.ts:115
The nearest ancestor scene node, or null for persistent nodes and the root (ADR 0016).
GameObject | null
get tags(): string[];Defined in: src/engine/scene/GameObject.ts:98
string[]
set tags(value): void;Defined in: src/engine/scene/GameObject.ts:99
string[]
void
get transform(): Transform | null;Defined in: src/engine/scene/GameObject.ts:125
Transform | null
addBehavior<T>(type, init?): T;Defined in: src/engine/scene/GameObject.ts:169
Attach a component to this node. init values that are another World's nodes or components
throw (ADR 0032). A component registered for other Worlds (@behavior(id, { worlds }), ADR
0033) isn't attached: you get a detached instance that never runs and that getBehavior
doesn't find (see _componentAllowedIn).
T extends Component
ConcreteComponentType<T>
ComponentInit<T>
T
addChildBehavior<T>(type, options?): T;Defined in: src/engine/scene/GameObject.ts:180
Attach a component on a new component node under this node (ADR 0009). The component's
owner is this node; the component node has its own transform for offsets.
T extends Component
ConcreteComponentType<T>
ComponentInit<T>
string
T
addComponent<T>(type, init?): T;Defined in: src/engine/scene/GameObject.ts:243
T extends Component
ConcreteComponentType<T>
ComponentInit<T>
T
addData<S>(def, init?): DataView<S>;Defined in: src/engine/scene/GameObject.ts:251
S extends Schema
Partial<Record<keyof S, number | boolean>>
DataView<S>
find(path): GameObject | null;Defined in: src/engine/scene/GameObject.ts:152
Find a descendant by slash-separated name path, e.g. "Weapon/Muzzle".
string
GameObject | null
getBehavior<T>(type): T | null;Defined in: src/engine/scene/GameObject.ts:190
First component of type attached directly to this node.
T extends Component
ComponentType<T>
T | null
getBehaviorInChildren<T>(type, includeInactive?): T | null;Defined in: src/engine/scene/GameObject.ts:215
First component of type on this node or any descendant (depth-first).
T extends Component
ComponentType<T>
boolean = false
T | null
getBehaviorInComponents<T>(type): T | null;Defined in: src/engine/scene/GameObject.ts:203
Attached components plus those on this node's component-node children (ADR 0009).
T extends Component
ComponentType<T>
T | null
getBehaviorInParent<T>(type): T | null;Defined in: src/engine/scene/GameObject.ts:228
First component of type on this node or any ancestor.
T extends Component
ComponentType<T>
T | null
getBehaviors<T>(type): T[];Defined in: src/engine/scene/GameObject.ts:197
All components of type attached directly to this node.
T extends Component
ComponentType<T>
T[]
getComponent<T>(type): T | null;Defined in: src/engine/scene/GameObject.ts:244
T extends Component
ComponentType<T>
T | null
getComponentInChildren<T>(type, includeInactive?): T | null;Defined in: src/engine/scene/GameObject.ts:246
T extends Component
ComponentType<T>
boolean = false
T | null
getComponentInParent<T>(type): T | null;Defined in: src/engine/scene/GameObject.ts:247
T extends Component
ComponentType<T>
T | null
getComponents<T>(type): T[];Defined in: src/engine/scene/GameObject.ts:245
T extends Component
ComponentType<T>
T[]
getData<S>(def): DataView<S> | null;Defined in: src/engine/scene/GameObject.ts:258
S extends Schema
DataView<S> | null
hasData(def): boolean;Defined in: src/engine/scene/GameObject.ts:264
boolean
hasTag(tag): boolean;Defined in: src/engine/scene/GameObject.ts:100
string
boolean
removeBehavior(component): void;Defined in: src/engine/scene/GameObject.ts:237
Queue a component on this node for removal at the end of the frame.
void
removeData(def): void;Defined in: src/engine/scene/GameObject.ts:269
void
setActive(active): void;Defined in: src/engine/scene/GameObject.ts:104
boolean
void
setParent(parent, options?): boolean;Defined in: src/engine/scene/GameObject.ts:145
Reparent. By default the world transform is kept. Returns false if it would create a cycle. Throws for a parent in another World (ADR 0032).
GameObject
boolean
boolean
toString(): string;Defined in: src/engine/scene/GameObject.ts:274
string
static create(name?, options?): GameObject;Defined in: src/engine/scene/GameObject.ts:44
Create an empty node: in the parent's World when one is given, else in the current World
(ADR 0032, 0034). Passing a parent is how code after an await stays in its own World.
string = "GameObject"
GameObject | null
boolean
GameObject
static destroy(target): void;Defined in: src/engine/scene/GameObject.ts:61
Queue a node (with its subtree) or a component for destruction at the end of the frame.
Component | GameObject
void
static findObjectOfType<T>(type): T | null;Defined in: src/engine/scene/GameObject.ts:72
First active component of type in the active world.
T extends Component
ComponentType<T>
T | null
static findObjectsOfType<T>(type): T[];Defined in: src/engine/scene/GameObject.ts:77
All active components of type in the active world.
T extends Component
ComponentType<T>
T[]
static instantiate(prefabPath, options?): GameObject;Defined in: src/engine/scene/GameObject.ts:56
Instantiate a prefab file (a scene file with one root node, ADR 0013/0016) and return its
root: in the parent's World when one is given, else in the current World (ADR 0032, 0034).
awake/onEnable run before this returns; start runs next frame. In a behavior,
this.instantiate always uses the behavior's own World.
string
InstantiateOptions = {}
GameObject
static makePersistent(node): void;Defined in: src/engine/scene/GameObject.ts:67
Move a node directly under the World root so it survives scene loads (ADR 0016).
GameObject
void
This wiki is generated from docs/wiki/ and the myco module's source on every push to master. Change pages there in a pull request: edits made here are not kept.
Basics
Gameplay
Rendering
Audio
- Playing sound
- Why is there no sound?
- Playlists
- Interactive music
- Sound generators
- Spatial audio
- Audio mixer
- Live mixing
- Loudness
- Audio profiler
- Audio takes
Reference