![]() |
BomberUnits
...a Unity learning project
|
A wrapper that provides the means to safely serialize Scene Asset References. More...
Inheritance diagram for SceneReference:
Collaboration diagram for SceneReference:Public Member Functions | |
| bool | IsCurrentScene () |
| void | OnBeforeSerialize () |
| void | OnAfterDeserialize () |
Static Public Member Functions | |
| static implicit | operator string (SceneReference sceneReference) |
Properties | |
| string | ScenePath [get, set] |
Private Attributes | |
| string | scenePath = string.Empty |
A wrapper that provides the means to safely serialize Scene Asset References.
Internally we serialize an Object to the SceneAsset which only exists at editor time. Any time the object is serialized, we store the path provided by this Asset (assuming it was valid).
This means that, come build time, the string path of the scene asset is always already stored, which if the scene was added to the build settings means it can be loaded.
It is up to the user to ensure the scene exists in the build settings so it is loadable at runtime. To help with this, a custom PropertyDrawer displays the scene build settings state.
Known issues:
Definition at line 29 of file SceneReference.cs.