Class ScyllaSceneWillUnloadEvent
Published by ScyllaSceneManager for each scene that is about to be destroyed by a managed operation: the explicit target of a call to an unload API, or every currently loaded scene when a UnityEngine.SceneManagement.LoadSceneMode.Single load is about to replace them.
Inherited Members
Namespace: Scylla.Core.Scenes
Assembly: ScyllaCore.dll
Syntax
public sealed class ScyllaSceneWillUnloadEvent : ScyllaEvent
Remarks
For an explicit unload this event is published once, before the hygiene pipeline runs and before the underlying Unity or Addressables unload operation starts; the matching ScyllaSceneUnloadedEvent follows once the unload completes. For a single-mode load, one instance of this event is published per currently loaded scene immediately before the corresponding ScyllaSceneWillLoadEvent, since Unity destroys every existing scene as part of that load; no explicit unload API call is involved in that case. Additive loads never publish this event.
This is the last chance to read state out of the scene's objects; the Scene handle and everything in it become invalid once the unload proceeds. The hygiene pipeline (tween kill, timescale modifier clear, event subscriber prune) runs after this event, so subscribers may still rely on tweens and timescale modifiers being alive while handling it.
Like every ScyllaEvent, a handler can call StopPropagation() to keep lower-priority subscribers of this same event from receiving it. ScyllaSceneManager never reads IsCancelled after publishing it, so cancelling this event does not prevent, delay, or otherwise influence the unload that is about to happen.
Constructors
ScyllaSceneWillUnloadEvent(Scene)
Initializes a new ScyllaSceneWillUnloadEvent.
Declaration
public ScyllaSceneWillUnloadEvent(Scene scene)
Parameters
| Type | Name | Description |
|---|---|---|
| Scene | scene | The handle of the scene about to be unloaded. |
Properties
Scene
Gets the handle of the scene about to be unloaded. Valid only until the unload proceeds.
Declaration
public Scene Scene { get; }
Property Value
| Type | Description |
|---|---|
| Scene | A UnityEngine.SceneManagement.Scene handle that is still valid at publish time. Do not retain it past the current handler; it becomes invalid once the unload proceeds. |