Repository navigation
API Class GameObject
Defined in: src/engine/core/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/core/GameObject.ts:108
The node's own active flag.
boolean
get activeInHierarchy(): boolean;Defined in: src/engine/core/GameObject.ts:112
Active only if this node and all its ancestors are active.
boolean
get children(): GameObject[];Defined in: src/engine/core/GameObject.ts:141
GameObject[]
get id(): string;Defined in: src/engine/core/GameObject.ts:98
Stable id from scene data (empty for nodes created at runtime).
string
get isComponentNode(): boolean;Defined in: src/engine/core/GameObject.ts:115
True for component nodes: child nodes that host components on behalf of their parent (ADR 0009).
boolean
get isSceneNode(): boolean;Defined in: src/engine/core/GameObject.ts:117
boolean
get isValid(): boolean;Defined in: src/engine/core/GameObject.ts:89
False once the node has been destroyed.
boolean
get name(): string;Defined in: src/engine/core/GameObject.ts:100
string
set name(value): void;Defined in: src/engine/core/GameObject.ts:101
string
void
get parent(): GameObject | null;Defined in: src/engine/core/GameObject.ts:135
GameObject | null
get scene(): GameObject | null;Defined in: src/engine/core/GameObject.ts:120
The nearest ancestor scene node, or null for persistent nodes and the root (ADR 0016).
GameObject | null
get tags(): string[];Defined in: src/engine/core/GameObject.ts:103
string[]
set tags(value): void;Defined in: src/engine/core/GameObject.ts:104
string[]
void
get transform(): Transform | null;Defined in: src/engine/core/GameObject.ts:130
Transform | null
addBehavior<T>(type, init?): T;Defined in: src/engine/core/GameObject.ts:176
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). UI components (UICanvas, UIPanel, UIText,
UIImage, UIButton, UIInputField…) throw: only a UIView rendering its component makes them
(ADR 0421, amended by 0423).
T extends Component
ConcreteComponentType<T>
ComponentInit<T>
T
addChildBehavior<T>(type, options?): T;Defined in: src/engine/core/GameObject.ts:188
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/core/GameObject.ts:252
T extends Component
ConcreteComponentType<T>
ComponentInit<T>
T
addData<S>(def, init?): DataView<S>;Defined in: src/engine/core/GameObject.ts:260
S extends Schema
Partial<Record<keyof S, number | boolean>>
DataView<S>
find(path): GameObject | null;Defined in: src/engine/core/GameObject.ts:157
Find a descendant by slash-separated name path, e.g. "Weapon/Muzzle".
string
GameObject | null
getBehavior<T>(type): T | null;Defined in: src/engine/core/GameObject.ts:199
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/core/GameObject.ts:224
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/core/GameObject.ts:212
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/core/GameObject.ts:237
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/core/GameObject.ts:206
All components of type attached directly to this node.
T extends Component
ComponentType<T>
T[]
getComponent<T>(type): T | null;Defined in: src/engine/core/GameObject.ts:253
T extends Component
ComponentType<T>
T | null
getComponentInChildren<T>(type, includeInactive?): T | null;Defined in: src/engine/core/GameObject.ts:255
T extends Component
ComponentType<T>
boolean = false
T | null
getComponentInParent<T>(type): T | null;Defined in: src/engine/core/GameObject.ts:256
T extends Component
ComponentType<T>
T | null
getComponents<T>(type): T[];Defined in: src/engine/core/GameObject.ts:254
T extends Component
ComponentType<T>
T[]
getData<S>(def): DataView<S> | null;Defined in: src/engine/core/GameObject.ts:267
S extends Schema
DataView<S> | null
hasData(def): boolean;Defined in: src/engine/core/GameObject.ts:273
boolean
hasTag(tag): boolean;Defined in: src/engine/core/GameObject.ts:105
string
boolean
removeBehavior(component): void;Defined in: src/engine/core/GameObject.ts:246
Queue a component on this node for removal at the end of the frame.
void
removeData(def): void;Defined in: src/engine/core/GameObject.ts:278
void
setActive(active): void;Defined in: src/engine/core/GameObject.ts:109
boolean
void
setParent(parent, options?): boolean;Defined in: src/engine/core/GameObject.ts:150
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/core/GameObject.ts:283
string
static create(name?, options?): GameObject;Defined in: src/engine/core/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/core/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/core/GameObject.ts:77
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/core/GameObject.ts:82
All active components of type in the active world.
T extends Component
ComponentType<T>
T[]
static instantiate(prefabPath, options?): GameObject;Defined in: src/engine/core/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/core/GameObject.ts:71
Move a node directly under the World root so it survives scene loads (ADR 0016). Throws for a scene node (a loaded scene or a sub-scene, ADR 0630): under the root a scene node is a loaded scene, which the next replacing load destroys; make the nodes inside it persistent, or list the scene as an autoload.
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