Repository navigation
API Class UIView
Defined in: src/plugins/ui/runtime/UIView.ts:67
Base class for everything attached to a node: built-in engine components and user
GameBehaviors (ADR 0007, 0009). Instances are created by the engine
(node.addBehavior(Type) or scene loading), never with new by game code.
ScreenView
new UIView(): UIView;UIView
autoFocus: boolean = false;Defined in: src/plugins/ui/runtime/UIView.ts:83
Focus firstSelected (else the first focusable element) when the view becomes active.
bind: Record<string, string[]> = {};Defined in: src/plugins/ui/runtime/UIView.ts:102
ADR 0681: queries it binds, by prop name ({ ships: ["pirates.Captain", "pirates.Awareness"] }). Each prop is a
store of plain rows, one per node with every listed component ({ entity, id, captain: {…}, awareness: {…} }:
entity for a keyed {#each}, id the node's id), updated as nodes join, leave or change. Nodes in a scene being edited match only a
view that is too. Read when it mounts: replacing the object mounts it again.
cancelPops: boolean = true;Defined in: src/plugins/ui/runtime/UIView.ts:124
ADR 0668: the UI cancel action (Escape, the east button) on this screen, while on top, takes it off (false: a root menu that stays).
ScreenView.cancelPops
component: string = "";Defined in: src/plugins/ui/runtime/UIView.ts:69
The Svelte component (asset:ui/hud.svelte).
dataProps: Record<string, string> = {};Defined in: src/plugins/ui/runtime/UIView.ts:95
ADR 0681: the data components of its node it shows, by the prop name its component reads ({ hudPlayer: "pirates.HudPlayer" }). Each prop is a store of the component's fields as plain values ($hudPlayer.hp), set when
the row changes; null while the node doesn't have it. Read when it mounts: replacing the object mounts it again.
firstSelected: string = "";Defined in: src/plugins/ui/runtime/UIView.ts:89
Where autoFocus, a modal view, and navigate with nothing focused put focus (ADR 0340): the id of an element the
component renders ("options" or "#options"), followed as it re-renders (the element that has the id now, none
once it's gone). Empty: the first focusable element.
matchHeight: number = 1;Defined in: src/plugins/ui/runtime/UIView.ts:75
0: scale with the canvas width; 1: with its height; between: a blend.
maxUpdateRate: number = 0;Defined in: src/plugins/ui/runtime/UIView.ts:115
How many times a second its UI updates at most; 0: every frame (ADR 0667, as Ultralight's set_max_render_fps).
Between updates the component's queued changes wait and its elements aren't restyled, so they hold still and cost
nothing to lay out; each update catches up on what changed since. Counted in the World's unscaled time, so a
paused game's UI still updates. Input to one of its elements, a resize of its canvas and enabling the view update it
at once. For secondary views (a scoreboard, a world-space panel) whose changes needn't show every frame.
Not capped: CSS transitions and keyframe animations already running, requestAnimationFrame callbacks, and changes
Svelte applies outside this view's frame flush (its own microtask between frames, or another view's flush: Svelte
flushes every component at once). Text and elements those write show when they happen; the restyles they cause
(classes, inline styles) still wait for the next update.
modal: boolean = false;Defined in: src/plugins/ui/runtime/UIView.ts:81
While it has a focusable element, focus can't leave it (ADR 0340).
mode: UICanvasMode = "screen";Defined in: src/plugins/ui/runtime/UIView.ts:71
The canvas's settings (as UICanvas's): screen covers the canvas, world is a panel in the scene.
path: string = "";Defined in: src/plugins/ui/runtime/UIView.ts:122
ADR 0668: a screen's path pattern, with parameters (/results/:matchId); empty: / and the route.
ScreenView.path
pixelSize: number = 0.01;Defined in: src/plugins/ui/runtime/UIView.ts:79
World mode: world units per UI pixel.
referenceResolution: Vector2;Defined in: src/plugins/ui/runtime/UIView.ts:73
The UI's design size in UI pixels.
route: string = "";Defined in: src/plugins/ui/runtime/UIView.ts:120
ADR 0668: its name as a screen (results), for UIScreens.push("results"). A view with a route is shown only while
it's in its World's screen stack (edit mode shows it as authored); empty: not a screen, shown while active.
ScreenView.route
sortOrder: number = 0;Defined in: src/plugins/ui/runtime/UIView.ts:77
Screen canvases draw (and take the pointer) in ascending order: higher is on top. A whole number, as Unity's (ADR 0662): a fraction sorts rounded.
transformError: ((error) => unknown) | null = null;Defined in: src/plugins/ui/runtime/UIView.ts:131
Svelte's transformError (ADR 0423): turns an error a <svelte:boundary> catches into what its failed snippet
and onerror get (a framework's error hook: a message safe to show, an error id). Read when an error is caught,
so setting it takes effect at once; null passes errors through unchanged.
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 exports(): Record<string, unknown> | null;Defined in: src/plugins/ui/runtime/UIView.ts:173
The root component's exports while it's mounted (what Svelte's mount returns: its export const and
export function values), or null before it mounts. A remount (re-enabling, hot reload) gives a new object.
Record<string, unknown> | null
get gameObject(): GameObject;Defined in: src/engine/core/Component.ts:43
Unity-style alias for node.
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
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 player(): number;Defined in: src/plugins/ui/runtime/UIView.ts:181
The local player whose UI actions drive it (ADR 0681): the nearest ControlledBy { player } up its hierarchy; -1
without one (any local player).
number
get props(): Record<string, unknown>;Defined in: src/plugins/ui/runtime/UIView.ts:157
The component's props. Reactive once mounted: view.props.score = 10 (or a change inside a prop's
object or array) shows in the same frame. Assigning an object replaces every prop.
Record<string, unknown>
set props(value): void;Defined in: src/plugins/ui/runtime/UIView.ts:161
Record<string, unknown>
void
get ready(): Promise<void>;Defined in: src/plugins/ui/runtime/UIView.ts:186
Resolves once the component is mounted (at once if it is).
Promise<void>
get root(): UIViewElement | null;Defined in: src/plugins/ui/runtime/UIView.ts:192
The canvas the component renders into, or null before it's mounted.
UIViewElement | null
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 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.
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 = {}
query(selector): UIViewElement | null;Defined in: src/plugins/ui/runtime/UIView.ts:202
The first rendered element a selector matches (#play, .row button), or null.
string
UIViewElement | null
queryAll(selector): UIViewElement[];Defined in: src/plugins/ui/runtime/UIView.ts:207
Every rendered element a selector matches, in tree order.
string
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