Editor
Scripts
Attaching and editing scripts in the editor.
Creating Scripts
Create scripts from the Scripts tab in the Explorer panel. Each script is a JavaScript file that you edit with the built-in code editor.
Attaching Scripts
Scripts are attached to objects. Select an object, then assign a script to it from the properties panel. The same script can be attached to multiple objects — each runs independently.
Script Structure
Every script can export three functions:
export function init(ctx) {
// Runs once when the game starts
}
export function update(ctx) {
// Runs every frame
}
export function onMessage(ctx, message) {
// Receives messages from other scripts
}All three are optional — include only what you need. The ctx parameter gives you access to the engine API. See Scripting API for the full reference.
Editing Scripts
The script editor supports autocompletion and type hints for the engine API. Changes are applied immediately when you switch back to the viewport.