Creator · Visual Scripting
Visual Scripting Events
Custom events are typed room-local messages routed by Runtime. They are the right tool when one script needs to notify another script about gameplay that already happened, such as a pickup collected, a hit applied, or a timer phase entered.
engine v1.0.234Copy for LLM
Authoring
- Create custom events in the Events panel.
- Add typed payload parameters to document the event data.
- Use Event Dispatch nodes to emit events.
- Use Event Receive nodes or an
onCustomEventhandler to react to events.
SDK Access
Generated scripts emit custom events through the single room-local event atom:
ctx.events.emit("powerup.spawned", {
entityId: "pickup_1",
type: "speed"
});
During custom-event dispatch, the runtime calls onCustomEvent; match on the event key before handling the payload:
export function onCustomEvent(ctx, event) {
if (event.eventKey !== "powerup.spawned") return;
ctx.log("info", "Powerup spawned", event.payload);
}
Cross-entity and cross-script emit use the same Runtime event router:
ctx.events.emit("round.started", { round: 2 });