class

SceneManager

Scene Manager - handles scene loading, switching, and lifecycle

Module
Game
Header
#include "Scene/SceneManager.h"
Namespace
Mowo

Type aliases

AliasDescription
using SceneCallback = std::function<void(Scene*)>Callbacks

Constructors

SignatureNameDescription
SceneManager()SceneManager
~SceneManager()~SceneManager

Public functions

ReturnsNameDescription
SceneManager&GetSingleton access
SceneManager*TryGetNull-safe singleton accessor.
voidInitialize
voidShutdown
voidProcessPendingSceneSwitchApplies a scene switch requested since the last call; the host ticks the scene itself
Scene*CreateSceneScene creation
Scene*LoadSceneScene loading
Scene*FindLoadedSceneThe scene already loaded from path, or null.
Scene*LoadSceneFromDocumentLoadScene for a document the caller read and parsed itself — the editor does that on a worker so a large level's parse never holds a frame.
boolReadSceneDocumentReads path into the document LoadSceneFromDocument takes, assembling a split .mmap from its actor files.
boolSaveScene
voidUnloadScene
Scene*CreatePlayWorldPlay-in-editor worlds.
Scene*LoadScenePlayCopy
intLoadSceneAdditiveAdditive load — appends entities from path to target, leaving target's environment and existing entities untouched.
voidSetActiveSceneActive scene management
Scene*GetActiveScene
voidSwitchToSceneScene switching (with optional transition)
voidSwitchToScene
Scene*GetSceneScene queries
boolHasScene
voidSetOnSceneLoaded
voidSetOnSceneUnloaded
voidSetOnSceneChanged

Function details

SceneManager

C++
SceneManager()

~SceneManager

C++
~SceneManager()

Get

C++
static SceneManager& Get()

Singleton access

TryGet

C++
static SceneManager* TryGet()

Null-safe singleton accessor. Returns nullptr if SceneManager has not been initialised yet OR has already been destroyed (e.g. during shutdown, where ~Engine tears the manager down before the editor layer's OnDetach fires). Callers in shutdown paths must prefer this over Get() to avoid dereferencing a null this.

Initialize

C++
void Initialize()

Shutdown

C++
void Shutdown()

ProcessPendingSceneSwitch

C++
void ProcessPendingSceneSwitch()

Applies a scene switch requested since the last call; the host ticks the scene itself

CreateScene

C++
Scene* CreateScene(const std::string& name)

Scene creation

LoadScene

C++
Scene* LoadScene(const std::string& path)

Scene loading

FindLoadedScene

C++
Scene* FindLoadedScene(const std::string& path) const

The scene already loaded from path, or null. What LoadScene returns without touching the disk when the file is open already.

LoadSceneFromDocument

C++
Scene* LoadSceneFromDocument(const std::string& path, MDF::MdfDocument& doc)

LoadScene for a document the caller read and parsed itself — the editor does that on a worker so a large level's parse never holds a frame.

ReadSceneDocument

C++
static bool ReadSceneDocument(const std::string& path, MDF::MdfDocument& doc)

Reads path into the document LoadSceneFromDocument takes, assembling a split .mmap from its actor files. A caller that parsed the .mmap itself got the world settings alone and loaded an empty level. Touches only the VFS, so it runs on a worker.

SaveScene

C++
bool SaveScene(Scene* scene, const std::string& path = "")

UnloadScene

C++
void UnloadScene(Scene* scene)

CreatePlayWorld

C++
Scene* CreatePlayWorld(const Scene& source)

Play-in-editor worlds. CreatePlayWorld duplicates an edited document into a separate scene the game runs in, so Play never writes into the level and Stop just unloads the copy. LoadScenePlayCopy is the travel half: it always loads path fresh, because the scene already open under that path is an editor document the game must not run in.

LoadScenePlayCopy

C++
Scene* LoadScenePlayCopy(const std::string& path)

LoadSceneAdditive

C++
int LoadSceneAdditive(const std::string& path, Scene* target = nullptr)

Additive load — appends entities from path to target, leaving target's environment and existing entities untouched. The merged entities receive fresh UUIDs so two additive loads of the same file produce independent sets. Returns the number of entities merged (0 on parse failure / missing file). Pass nullptr target to use the currently active scene.

SetActiveScene

C++
void SetActiveScene(Scene* scene)

Active scene management

GetActiveScene

C++
Scene* GetActiveScene() const

SwitchToScene

C++
void SwitchToScene(const std::string& path)

Scene switching (with optional transition)

SwitchToScene

C++
void SwitchToScene(Scene* scene)

GetScene

C++
Scene* GetScene(const std::string& name) const

Scene queries

HasScene

C++
bool HasScene(const std::string& name) const

SetOnSceneLoaded

C++
void SetOnSceneLoaded(SceneCallback callback)

SetOnSceneUnloaded

C++
void SetOnSceneUnloaded(SceneCallback callback)

SetOnSceneChanged

C++
void SetOnSceneChanged(SceneCallback callback)
Generated from Scene/SceneManager.h via game.json · Nov 5, 2026Version 1.0.0