Understanding SuperScenes data
SuperScenes tries its best to work like magic and allow you to add and remove components with ease. However, if necessary, this page can give you more info on how SuperScenes data is stored, both in editor and at runtime.
Edit-time data
SceneDataSO
Components for a given scene are stored in a ScriptableObject of type SceneDataSO
. Whenever you select a Scene asset to add components, a Scene Data SO is automatically created.
This ScriptableObject stores:
A reference to the SceneAsset file (only for edit-time)
The path to this file (for runtime)
A list of Scene Components
The path cannot be edited, and will be inferred from the Scene asset, and refreshed both when the editor starts, and double-checked when the game builds.
SceneDataRegistry
All Scene Data SO ScriptableObjects are referenced in another ScriptableObject, of type SceneDataRegistry
.
This is supposed to exist only in one copy, and will be created for you when the editor starts. This one copy can be accessed using SceneDataRegistry.Instance
(at both runtime and edit time).
Data location
In the Unity editor, all the Scene Data SO and the Scene Data Registry ScriptableObjects are kept together in a specific folder. The path to this folder can be customised in Project Settings > SuperScenes.
You can customise the path to be anything you want: the data doesn't need to be inside a Resources folder.
If you modify the path and the assets already exist, ensure to move them to the new path before continuing.
Runtime data
At runtime, the key to access the data becomes the Scene Data Registry ScriptableObject. This object is automatically added to the build's Preloaded assets, so there is no action to take on your side.
When the game loads, the ScriptableObject will be loaded into memory before any scene loads. It will then be available to query at any time during the game, using the provided SuperScenes API.
Last updated