← The API

Phaser AE

API docs

v3.0.0-2206 exports in 26 modulesreleased October 19, 2026

ContentsScenes

Need to get started? Install the Phaser AE CLI →

Time and flow

Scenes

The scene stack: go, push, pop, and suspension beneath a push

engine/kernel/src/scene.ts

Types

SceneDef

interface SceneDef

From @phaser-ae/kernel

A scene: a name and what happens on the way in and out. Scenes are a kernel service because ownership hangs off them: every object, timer, game.step, game.frame and own disposer belongs to the scene that was current when it was made, and goes when that scene exits.

  • readonly name: string — Unique: registering the name again replaces the scene.
  • enter?(): void — Runs after the scene.enter hook, with this scene current: what it spawns, schedules and steps is this scene's.
  • exit?(): void — Runs first when the scene leaves, before the scene.exit hook, while the scene's objects still exist.

Scenes

interface Scenes

From @phaser-ae/kernel

The scene stack, bottom to top. Every name must be registered before go or push; unknown names throw.

  • register(def: SceneDef): void — Define a scene. Registering a name again replaces it (the last definition wins), so a scene registered inside another's enter can run again; a scene on the stack exits and enters by its new definition from then on.
  • has(name: string): boolean — Is a scene registered under this name? For a pack that wants to supply a default only when the game has not.
  • go(name: string): void — Exit the entire stack, top first, and enter the destination: everything the exited scenes made goes with them. Going to the current scene restarts it. Use push/pop for overlays.
  • push(name: string, opts?: { transparent?: boolean; suspend?: boolean }): void — Push a scene over the current one. By default the scenes beneath are SUSPENDED: their objects stay on stage and keep rendering, frozen — out of every query, their anims and timers and game.steps held — until pop(). This is the game-level pause (a pause menu, a shop, a dialogue). suspend: false runs them in parallel (a HUD). transparent: false also hides the scenes beneath. A scene already on the stack cannot be pushed again: it throws.
  • isSuspended(name: string): boolean — Is this scene currently suspended beneath another?
  • pop(): void — Leave the top scene and resume what it suspended. The scene beneath is current again: objects, timers and steps made after pop belong to it. No-op when only one scene is on the stack.
  • readonly current: string — The top of the stack; '' before the first go.
  • readonly stack: ReadonlyArray<string> — Bottom to top.