Repository navigation
API Variable Assets
const Assets: object;Defined in: src/engine/scene/Assets.ts:116
get platform(): ImportPlatform;The platform per-platform import overrides resolve for (ADR 0115): "android" under Tauri mobile on Android, "desktop" under Tauri elsewhere, else "web" (ADR 0351 §1); settable (null = detect).
set platform(value): void;ImportPlatform | null
void
addSource(source): void;void
bytes(path): Promise<Uint8Array<ArrayBufferLike>>;A file's bytes, fetched from its URL (Assets.url); read from disk for the dedicated server's file: URLs.
string
Promise<Uint8Array<ArrayBufferLike>>
clearSources(): void;void
fromGlob(modules): AssetSource;Wrap the result of a Vite glob import made from the game's asset folder:
import.meta.glob("./**/*.{png,mp3,json}", { eager: true, import: "default" }).
Keys are paths relative to that folder; values are URLs or parsed JSON. Text files (ADR 0254)
must hold their contents, so glob those with query: "?raw".
Record<string, unknown>
fromObject(map): AssetSource;A source backed by a plain object, handy for tests: { "scenes/a.json": {...} }.
Record<string, unknown>
get(path): unknown;The raw asset value (see AssetSource.get), for comparing what a file held; read values
through json, text or url. Throws if no source has the asset.
string
unknown
has(path): boolean;string
boolean
importSettings(path): ImportSettings;An asset's import settings (ADR 0040), read from its sidecar <path>.meta.json; the defaults
when it has none. A slice reference (images/a.png#walk_0) reads its image's. Problems in
the sidecar are reported once each as warnings, and the defaults used for those values.
Per-platform overrides are resolved for Assets.platform (ADR 0115).
string
json<T>(path): T;A JSON file's parsed contents (scenes, prefabs, project settings). Throws for other files.
T = unknown
string
T
removeSource(source): void;void
text(path): string;A text file's contents (.xml, .css, .wgsl, .glsl, .md, .txt, JavaScript). Throws for
other files: one that loads as a URL (a .cube LUT, an .obj) is read with Assets.bytes.
string
string
url(path): string;The URL serving a file's bytes (images, audio, models, fonts, LUTs). Throws for JSON and text files, which load as their contents.
string
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