Scenes
Updated
A scene is one space of your world: a lobby, a gallery room, a game level, a menu, a heads-up display. Each scene holds its own entities and its own look, such as the sky, the fog, the lighting and the background. Scenes let a world be split into parts that load when they are needed.
One project, several scenes
Section titled “One project, several scenes”A project can have as many scenes as you need. One of them is the default scene, the one visitors arrive in. From there, the world can move visitors to another scene, for example when they walk through a door or press a button.
Scenes can also be stacked: a scene can be loaded on top of the active one, for example a heads-up display or a shared menu, and removed again later. The scenes that are showing are the active scenes.
Switching scenes from a script
Section titled “Switching scenes from a script”A script changes scenes with the Scenes global:
#pragma lifecycle(startup)
async function startup() { // Replace the current scene with the one named 'gallery'. await Scenes.load('gallery');}#pragma lifecycle(startup)
async function startup() { // Add the 'hud' scene on top of the current one. await Scenes.load('hud', { additive: true });}