Repository navigation
API Class SubtitleDisplay
Defined in: src/plugins/subtitles/runtime/SubtitleDisplay.ts:49
A user script. Subclass it, implement lifecycle methods, and attach it to nodes.
@behavior("game.Spinner")
export class Spinner extends GameBehavior {
@field(Number) speed = 90;
update() { this.transform.rotation2D += this.speed * Time.deltaTime; }
}new SubtitleDisplay(): SubtitleDisplay;SubtitleDisplay
captions: boolean = true;Defined in: src/plugins/subtitles/runtime/SubtitleDisplay.ts:70
Shows captions when the player's setting allows.
component: string = "";Defined in: src/plugins/subtitles/runtime/SubtitleDisplay.ts:51
A Svelte component replacing the built-in one; it gets the rows and their placement as props (see the class's notes).
fadeIn: number = 0.12;Defined in: src/plugins/subtitles/runtime/SubtitleDisplay.ts:66
Seconds.
fadeOut: number = 0.2;Defined in: src/plugins/subtitles/runtime/SubtitleDisplay.ts:68
Seconds.
margin: number = 8;Defined in: src/plugins/subtitles/runtime/SubtitleDisplay.ts:54
% of the canvas height from the edge (title-safe).
maxLines: number = 2;Defined in: src/plugins/subtitles/runtime/SubtitleDisplay.ts:58
Lines per page before paging.
maxStack: number = 3;Defined in: src/plugins/subtitles/runtime/SubtitleDisplay.ts:60
Rows on screen at once.
maxWidth: number = 70;Defined in: src/plugins/subtitles/runtime/SubtitleDisplay.ts:56
% of the canvas width.
position: "top" | "bottom" = "bottom";Defined in: src/plugins/subtitles/runtime/SubtitleDisplay.ts:52
sizeScale: number = 1;Defined in: src/plugins/subtitles/runtime/SubtitleDisplay.ts:62
Multiplies the size presets.
speakerNames: SpeakerNameMode = "always";Defined in: src/plugins/subtitles/runtime/SubtitleDisplay.ts:64
always, whenSeveral (only while two or more speakers are shown) or never.
static executionOrder: number = 0;Defined in: src/engine/core/Component.ts:292
Lower values run earlier within the same hook.
get abortSignal(): AbortSignal;Defined in: src/engine/core/Component.ts:313
Aborted when this behavior is disabled or destroyed. Use it for fetch and other non-engine async work.
AbortSignal
get enabled(): boolean;Defined in: src/engine/core/Component.ts:63
boolean
set enabled(value): void;Defined in: src/engine/core/Component.ts:67
boolean
void
get gameObject(): GameObject;Defined in: src/engine/core/Component.ts:43
Unity-style alias for node.
get input(): BehaviorInput;Defined in: src/engine/core/Component.ts:307
The input of the player controlling this behavior's node (ADR 0336, 0337): the pawn's actions
(the nearest node up with ControlledBy or an action set), else player 0's.
this.input.vector2("move"), this.input.performed("jump"), this.input.on("heavy", "performed", fn).
BehaviorInput
get isActiveAndEnabled(): boolean;Defined in: src/engine/core/Component.ts:74
True when enabled, the node is active in the hierarchy, and the node is in a loaded world.
boolean
GameBehavior.isActiveAndEnabled
get node(): GameObject;Defined in: src/engine/core/Component.ts:38
The node this component is on.
get owner(): GameObject;Defined in: src/engine/core/Component.ts:51
The node this component acts for: the node itself when attached directly, or the parent node when this component lives on a component node (ADR 0009).
get time(): Readonly<TimeState>;Defined in: src/engine/core/Component.ts:99
This component's World's clock (ADR 0032): the same values as Time, but safe to read
outside the World's frame too (after an await, say).
Readonly<TimeState>
get transform(): Transform;Defined in: src/engine/core/Component.ts:57
The Transform of the node this component is on, if it has one.
get wait(): Waits;Defined in: src/engine/core/Component.ts:298
Engine-scheduled waits that respect pause and time scale, cancelled on disable/destroy (ADR 0018).
get world(): WorldHandle;Defined in: src/engine/core/Component.ts:88
A handle on this component's World (ADR 0132): the same one Engine.findWorld returns. Load
a scene into it, pause, connect or destroy it: this.world.loadScene("scenes/level2.scene.json").
Throws for a World no Engine owns.
awake?(): void | Promise<void>;Defined in: src/engine/core/Component.ts:157
void | Promise<void>
fixedUpdate?(): void;Defined in: src/engine/core/Component.ts:160
void
instantiate(prefabPath, options?): GameObject;Defined in: src/engine/core/Component.ts:109
Instantiate a prefab in this component's World (ADR 0034), like GameObject.instantiate.
Use it in code that may run after an await: by then the frame is over and the current World
is the Engine's default one, which may not be this component's. A parent from another
World throws.
string
InstantiateOptions = {}
lateUpdate?(): void;Defined in: src/engine/core/Component.ts:162
void
onAudioMarker?(e): void;Defined in: src/engine/core/Component.ts:203
A marker passing in the playlist an AudioSource on this node plays (ADR 0343): the Cue, Exit and Hit markers of its
samples and its sequences' cue and exit markers, every type (e.type says which), delivered by the audio system
(late update) on the first frame whose heard clock has passed it (e.time is exact). A playlist's beats and bars
reach onMusicBeat/onMusicBar from there too. Defining the hook is the subscription; the handle's
onMarker(type, fn) is the same for scripts that hold the handle.
void
onCollisionEnter?(collision): void;Defined in: src/engine/core/Component.ts:174
A Collision2D in 2D physics, a Collision in 3D physics: annotate the parameter with the one your game uses.
void
onCollisionExit?(collision): void;Defined in: src/engine/core/Component.ts:177
void
onCollisionStay?(collision): void;Defined in: src/engine/core/Component.ts:176
Every fixed step after onCollisionEnter while the two still touch (ADR 0093).
void
onControllerColliderHit?(hit): void;Defined in: src/engine/core/Component.ts:181
A CharacterController or CharacterController2D on this node ran into a collider during move (ADR 0091): a ControllerColliderHit or ControllerColliderHit2D.
void
GameBehavior.onControllerColliderHit
onDestroy(): void;Defined in: src/plugins/subtitles/runtime/SubtitleDisplay.ts:114
void
onDisable(): void;Defined in: src/plugins/subtitles/runtime/SubtitleDisplay.ts:108
void
onEnable(): void;Defined in: src/plugins/subtitles/runtime/SubtitleDisplay.ts:85
void
onJointBreak?(
joint,
force,
torque
): void;Defined in: src/engine/core/Component.ts:179
A Joint or Joint2D on this node broke (its breakForce or breakTorque was exceeded); it is destroyed after this (ADR 0092).
number
number
void
onMusicBar?(e): void;Defined in: src/engine/core/Component.ts:190
The first beat of each bar of that music (e.beat is 1), delivered as onMusicBeat is.
void
onMusicBeat?(e): void;Defined in: src/engine/core/Component.ts:188
A beat of the playlist an AudioSource on this node plays, when its playing entry has a tempo (a Sequence with a
tempo, or a sample with one): delivered by the audio system (late update) on the first frame whose heard clock has
passed it. After a gap of more than one beat the beats coalesce into one call with e.missed set (ADR 0166, 0343).
Defining the hook is the subscription. e is reused: read it during the call, don't keep it.
void
onMusicCue?(e): void;Defined in: src/engine/core/Component.ts:195
A cue of ADR 0166's music events. Playlists report cues as markers (onAudioMarker), so it isn't called for them
(ADR 0343); kept so old scripts still compile.
void
onTriggerEnter?(other): void;Defined in: src/engine/core/Component.ts:169
The other collider: a Collider2D in 2D physics, a Collider in 3D physics (the physics plugins, ADR
0135). Annotate the parameter with the one your game uses: onTriggerEnter(other: Collider2D).
void
onTriggerExit?(other): void;Defined in: src/engine/core/Component.ts:172
void
onTriggerStay?(other): void;Defined in: src/engine/core/Component.ts:171
Every fixed step after onTriggerEnter while the two still overlap (ADR 0093).
void
onWaterImpact?(e): void;Defined in: src/engine/core/Component.ts:222
A wave struck this node hard enough to throw spray (ADR 0663 §3): e.kind "hull" on a node with a WaterWake
(or a WaterDisturber with impactSpray above 0), "wall" on a WaterSurface's node for its baked depth map's
walls near the camera. Delivered as onWaterSplash is, with the same caveats: client-only, near the camera,
visual feedback only, never for gameplay. e is reused.
void
onWaterSplash?(e): void;Defined in: src/engine/core/Component.ts:215
This node fell into the water fast enough to splash (ADR 0663 §3): a body (a Buoyancy, a moving collider, a
WaterDisturber) whose footprint appeared on a WaterSurface while falling faster than 1.5 m/s. Delivered by the
Water plugin (late update) on the frame the splash burst plays, the same on every graphics tier (it stops only when
the surface's interaction is "off"). Defining the hook is the subscription. e is reused: read it during the
call, don't keep it.
Visual feedback, for a sound or an effect of your own: it fires only where water is drawn (never on a server), for
bodies the water near the camera reacts to, and isn't networked or deterministic. Never drive gameplay from it; use
Buoyancy.submerged or physics triggers for that.
void
onWorldPause?(): void;Defined in: src/engine/core/Component.ts:227
The World was paused (ADR 0615, WorldHandle.pause()): it stops stepping, and its sounds pause. Called once, at
the transition; a paused World's scripts don't run until onWorldResume.
void
onWorldResume?(): void;Defined in: src/engine/core/Component.ts:229
The World was resumed after onWorldPause (ADR 0615). Content that waited held gets only start, at activation.
void
start?(): void | Promise<void>;Defined in: src/engine/core/Component.ts:159
void | Promise<void>
update(): void;Defined in: src/plugins/subtitles/runtime/SubtitleDisplay.ts:120
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