Back to all docs
QubizSDK.events

Event System

A local event bus for game systems, editor integrations, host events, and reusable gameplay hooks.

eventsevent-bushooksgame-loop

Local event bus

Use QubizSDK.events for in-game events that should not always become analytics. The event bus is synchronous and local to the game frame. It also receives host events posted with source=nexa-host-event.

Subscribe and emit
const off = QubizSDK.events.on("quest:completed", (event) => {
  console.log(event.name, event.payload);
});

QubizSDK.events.emit("quest:completed", {
  questId: "tutorial-dash",
  reward: "dash-boots"
});

off();
Track only durable analytics
QubizSDK.events.on("quest:completed", async (event) => {
  await QubizSDK.analytics.track({
    name: "quest_completed",
    source: "quest-system",
    metadata: event.payload as Record<string, string | number | boolean>
  });
});