Class ScyllaSceneWillLoadEvent
Published by ScyllaSceneManager at the very start of a managed scene load, before the hygiene pipeline runs and before the underlying Unity (or Addressables) load operation is started. This is the first event a managed load produces and the earliest point at which subscribers can react to the pending scene change.
Inherited Members
Namespace: Scylla.Core.Scenes
Assembly: ScyllaCore.dll
Syntax
public sealed class ScyllaSceneWillLoadEvent : ScyllaEvent
Remarks
Fired by every managed load entry point: the synchronous
ScyllaSceneManager.LoadScene, the asynchronous by-name and by-index overloads,
and (when the Addressables package is installed) the addressable load overloads. For
a UnityEngine.SceneManagement.LoadSceneMode.Single load, one ScyllaSceneWillUnloadEvent
is published for every currently loaded scene immediately before this event, because
a single-mode load destroys them all. For an additive load no will-unload events
precede it. After this event, subscribers can expect zero or more
ScyllaSceneLoadProgressEvent events while the operation is in flight,
followed by ScyllaSceneLoadedEvent once the scene is activated.
Subscribers can use this event to release references into scenes that are about to be destroyed (single-mode loads), persist transient state, or start transition visuals such as a loading screen fade-in. The scene is identified by name or build index depending on which overload of the load API was called.
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 abort, delay, or otherwise influence the scene load that is about to start.
Constructors
ScyllaSceneWillLoadEvent(string, int, LoadSceneMode)
Initializes a new ScyllaSceneWillLoadEvent.
Declaration
public ScyllaSceneWillLoadEvent(string sceneName, int buildIndex, LoadSceneMode mode)
Parameters
| Type | Name | Description |
|---|---|---|
| string | sceneName | The scene name, or |
| int | buildIndex | The scene build index, or |
| LoadSceneMode | mode | The Unity load mode of the pending operation. |
Properties
BuildIndex
Gets the build index of the scene about to be loaded, or -1 when the load
was requested by name.
Declaration
public int BuildIndex { get; }
Property Value
| Type | Description |
|---|---|
| int |
Mode
Gets the Unity load mode of the pending operation.
Declaration
public LoadSceneMode Mode { get; }
Property Value
| Type | Description |
|---|---|
| LoadSceneMode | UnityEngine.SceneManagement.LoadSceneMode.Single if the load will replace every currently loaded scene (each of which gets its own ScyllaSceneWillUnloadEvent before this event), or UnityEngine.SceneManagement.LoadSceneMode.Additive if the scene is loaded alongside the scenes already open. |
SceneName
Gets the name of the scene about to be loaded, or null when the load was
requested by build index.
Declaration
public string SceneName { get; }
Property Value
| Type | Description |
|---|---|
| string |