Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ProwlEngine/Prowl/llms.txt
Use this file to discover all available pages before exploring further.
SceneManager is the static hub for all scene lifecycle operations in Prowl. It holds the currently active Scene, drives the per-frame update and physics tick for every GameObject it contains, dispatches rendering to all active Camera components, and provides store/restore helpers for the editor’s play-mode enter/exit flow. Because it is static, there is always exactly one active scene at a time; switching scenes calls Clear() to tear down the old one before the new one is loaded.
SceneManager lives in the Prowl.Runtime.SceneManagement namespace. Add using Prowl.Runtime.SceneManagement; if you reference it directly, or access it through the Prowl.Runtime aliases used elsewhere in the engine.Properties
The asset reference wrapping the active scene. Changing this directly is not recommended — use
LoadScene(...) or InstantiateNewScene() so that the proper teardown and initialization callbacks fire.Convenience accessor for the resolved
Scene instance. Equivalent to Current.Res!. Use this when you need direct access to AllObjects, ActiveObjects, or Add/Remove.Scene Loading
LoadScene (Scene overload)
Replaces the active scene with a fully constructedScene object. Calls Clear() first, then applies prefab links, fires the [OnSceneLoad] attribute callbacks, and calls OnLevelWasLoaded on every MonoBehaviour in the new scene.
The pre-built
Scene instance to make active.LoadScene (AssetRef overload)
Same as above but takes anAssetRef<Scene>. Throws if the reference is not yet available (i.e. the asset has not finished loading).
An asset reference to the scene. Must have
IsAvailable == true before calling.InstantiateNewScene
Clears the current scene and populates it with a default setup: a directional light and a main camera pre-configured withMotionBlurEffect, KawaseBloomEffect, and ToneMapperEffect. Fires [OnSceneLoad] callbacks after setup. Useful for the editor’s “New Scene” command or test harnesses.
Scene Storage (Editor Play Mode)
The store/restore pair lets the editor snapshot the scene before entering play mode and recover the original authored state when the user presses Stop.StoreScene
Serializes the current scene into an internalEchoObject snapshot and records its AssetID. Asserts (via Debug.If) that no scene is already stored.
RestoreScene
Deserializes the stored snapshot back into a liveScene, replaces Current, resolves prefab links, and fires [OnSceneLoad] attribute callbacks. Asserts that a snapshot exists. Note that OnLevelWasLoaded is not called on MonoBehaviour components during restore — it is only called by LoadScene.
ClearStoredScene
Discards the stored snapshot without restoring it. Asserts that a snapshot exists.Clear
Tears down the active scene: fires[OnSceneUnload] attribute callbacks, destroys the current Scene immediately (which in turn destroys all GameObjects and components), processes the engine’s destroy queue via EngineObject.HandleDestroyed(), resets the main camera reference, and replaces Current with a fresh empty Scene.
Clear() is also tagged [OnAssemblyUnload], so it fires automatically when the editor hot-reloads assemblies.Frame Loop
Update
Drives one simulation tick. Called each frame by the host’s update delegate (typically wired toApplication.Update).
- Snapshots the list of active
GameObjects. - Calls
PreUpdateon each, which triggers deferredAwakeandStartcalls on components. - Steps the physics world (only when
Application.IsPlaying). - Runs
UpdateCoroutinesandUpdateon every enabledMonoBehaviour. - Runs
LateUpdateon every enabledMonoBehaviour. - Runs end-of-frame coroutine queues.
PhysicsUpdate
Drives one fixed-rate physics tick. CallsFixedUpdate and the fixed-update coroutine queue on every enabled MonoBehaviour.
Draw
Collects allCamera components in the active scene (including those on child objects), sorts them by Camera.Depth, and renders each through its assigned RenderPipeline. Accepts an optional render-texture target for off-screen rendering.
When provided, any camera that does not have its own target renders into this texture. Pass
null (default) to render to the screen.true if at least one camera was found and rendered; false if the scene contains no cameras.Utility
ForeachComponent
Iterates a sequence ofGameObjects and invokes an Action<MonoBehaviour> for every enabled MonoBehaviour on each object. Used internally by Update, PhysicsUpdate, and Draw, but available for custom engine extensions.
The objects to iterate. Typically
Scene.ActiveObjects.The delegate to invoke for each enabled component. Skipped automatically if
MonoBehaviour.EnabledInHierarchy is false.Has
Checks whether a specificGameObject instance currently exists anywhere in the active scene (recursive search by InstanceID across Scene.AllObjects).
The GameObject to search for.
true if the object is found in the scene hierarchy; false otherwise.Scene Load Callbacks
[OnSceneLoad] and [OnSceneUnload] attribute hooks
[OnSceneLoad] and [OnSceneUnload] attribute hooks
Prowl provides two method-level attributes that let any static method in your codebase subscribe to scene transitions without coupling to
These hooks are discovered automatically by the assembly manager; no manual registration is required.
SceneManager directly:| Attribute | Fires when |
|---|---|
[OnSceneLoad] (via OnSceneLoadAttribute.Invoke()) | After a new scene is fully loaded and prefabs are resolved (called by LoadScene and InstantiateNewScene). |
[OnSceneUnload] (via OnSceneUnloadAttribute.Invoke()) | Before the current scene is destroyed during Clear(). |