-
Notifications
You must be signed in to change notification settings - Fork 1
SceneManagement
Namespace: WIDVE.Utilities
Location: WIDVE Unity Scripts/Utilities/SceneManagement
The SceneManagement
scripts provide multiple ways to handle Scenes
, both in the editor and in the build application.
The SceneObject
class allows Scenes
to be stored as ScriptableObjects
. This allows scenes and their data to be accessed in built applications, outside of the editor, where some of their data is no longer accessible or even included in builds. Scripts that need to load, unload, or otherwise access scenes while the program is running should use SceneObjects
instead for easier access in Play mode.
The SceneObject
class contains several static events that are invoked whenever a SceneObject
is loaded, unloaded, opened (editor only), or closed (editor only). These events are not invoked when the underlying Scene
is loaded through other methods; they are only invoked if the Scene
is loaded via the SceneObject's
load, unload, open, or close functions.
SceneObjects
can be created from the Create/Utilities/... menu.
Property | Description |
---|---|
ScenePath |
The path of the underlying Scene asset. |
Name |
Name of the Scene asset. |
Index |
Index of the scene in the build settings window. Currently not being set correctly and is unused. |
IsLoaded |
Returns true if the scene is currently loaded, false otherwise. |
Function | Description |
---|---|
GetScene() |
Returns the Scene asset associated with the SceneObject . |
Load() |
Loads the scene. Scene can be loaded in single or additive mode. |
Unload() |
Unloads the scene. Scene can be unloaded in single or additive mode. |
Open() |
Editor only: adds the scene to the current scene hierarchy (unloaded). |
Close() |
Editor only: unloads the scene and removes it from the current scene hierarchy. |
The SceneObjectList
is simply a ScriptableObject
that contains a reorderable list of SceneObjects
. One of the scenes can be marked as the active scene.