Babylon.js scene lifecycle
Gives the canvas, rendering loop and scene resources clear owners. It supports returning to menus, switching worlds and resuming the browser without accumulating loops or loading an abandoned scene.
babylonjs-scene-lifecycle
See how it helpsWhen is it useful?
Use when embedding Babylon.js in an application or switching worlds without accumulating background work.
What does it help you do?
- Assigns one owner to rendering loops and resize or scene observers.
- Rejects asynchronous callbacks that belong to a departed scene.
- Preserves deliberately shared assets while releasing scene-owned resources.
Try asking this
Switch our exploration game between the title screen and three islands ten times. Resize the browser during loading and leave one load early. Confirm there is one rendering loop, shared textures remain usable and callbacks from abandoned islands cannot change the current world.
Detailed documentation
Read the skill’s original instructions, examples and checks in their authored language.
Show less
Babylon.js — scene lifecycle
Use when creating Babylon scenes, switching worlds or embedding the engine in a web application.
Version and project gate
Inspect package.json and lockfile, Babylon package family and exact version, engine creation, WebGL/WebGPU choice, canvas hosting, loaders, physics plugin version and asset ownership. Keep Babylon Lite and the full engine APIs distinct. Never turn a task into an engine upgrade without the user’s intent. Read the version-matching official reference when an API decision depends on it.
Work
Find the sole owner of Engine, Scene, render loop and canvas. Define mount, suspend, switch and dispose transitions. Track observers and resize listeners with their owner. Gate asynchronous callbacks against a departed scene and preserve intentionally shared resources.
Deliver
A lifecycle map and a scene integration whose render loop and observers stop with its owner. Keep the change in the existing project structure; separate actual observations from the proposed acceptance scenario below.
Failure to prevent
Removing a mesh and disposing it are version/API-specific operations; do not transfer Lite lifetime rules to full-engine code.
Acceptance scenario
Mount and unmount the game repeatedly, switch scenes during loading and check for duplicate loops or orphan observers. Follow the project’s execution and verification permissions. If execution or a target device is unavailable, provide the reproduction steps and name the remaining uncertainty; do not mark it passed.
Scope and sources
This skill belongs to Ziva. Agent selection is restricted by Orqestria’s assigned-agent policy, including forced skill selection; instruction text alone is not an access control. These are original task workflows researched from official documentation, not a copied or endorsed vendor skill.
Included files 1
SKILL.md
