SaveSystem and Additive Scene Loading
Posted: Sun May 14, 2023 6:42 am
Hi again!
Sorry to raise two tickets in one day - load / save is my mission this weekend!
My project uses additive scene loading. My implementation is to have a "Master Scene" that contains a custom "Additive Scene Loader" component. This component, in the OnStart event, iterates through a list of scenes and calls SceneManager.LoadSceneAsync. The component invokes a UnityEvent once all scenes have been loaded, and another event once all scenes have been activated. I have a "Base Scene" that contains game managers, lighting, baked NavMesh etc, and that scene is set as the "Active Scene" in SceneManager, by the component code. Additional scenes contain terrain, scenery, NPCs, etc.
This "Master Scene", alongside the Additive Scene Loader, manages a loading screen and progress bar, calculated on the progress of the combined progress of all async load processes.
My hierarchy looks like this:
- Master Game Scene
|- Additive Scene Loader
|- Game Controller
|- UI Manager
|- Camera Manager
- Game Terrain Scene
|- All Terrain
- Base Scene
|- Ocean
|- Spawners
|- Quest Machine and Dialogue
|- Enviro
- Small Settlements Scene
- Medium Settlements Scene
- Large Settlements Scene
I was wondering if there's a pattern that I can adapt to use SaveSystem with this setup?
What I've tried so far, is to add my SaveSystem to the "Master Scene". What I've found, however, is that when I SaveGame, the save is created in the context of the "Active Scene", that is "Base Scene". Therefore, none of the additive scene-loading script is run.
I'm assuming there's more complexity that I haven't accounted for yet, such as managing Saver components across multiple scenes.
I was hoping a poke in the right direction might send me on my way?
I know this is a very specific implementation question, so my expectations are set that there's only so much help you can offer.
Many thanks again!
Sorry to raise two tickets in one day - load / save is my mission this weekend!
My project uses additive scene loading. My implementation is to have a "Master Scene" that contains a custom "Additive Scene Loader" component. This component, in the OnStart event, iterates through a list of scenes and calls SceneManager.LoadSceneAsync. The component invokes a UnityEvent once all scenes have been loaded, and another event once all scenes have been activated. I have a "Base Scene" that contains game managers, lighting, baked NavMesh etc, and that scene is set as the "Active Scene" in SceneManager, by the component code. Additional scenes contain terrain, scenery, NPCs, etc.
This "Master Scene", alongside the Additive Scene Loader, manages a loading screen and progress bar, calculated on the progress of the combined progress of all async load processes.
My hierarchy looks like this:
- Master Game Scene
|- Additive Scene Loader
|- Game Controller
|- UI Manager
|- Camera Manager
- Game Terrain Scene
|- All Terrain
- Base Scene
|- Ocean
|- Spawners
|- Quest Machine and Dialogue
|- Enviro
- Small Settlements Scene
- Medium Settlements Scene
- Large Settlements Scene
I was wondering if there's a pattern that I can adapt to use SaveSystem with this setup?
What I've tried so far, is to add my SaveSystem to the "Master Scene". What I've found, however, is that when I SaveGame, the save is created in the context of the "Active Scene", that is "Base Scene". Therefore, none of the additive scene-loading script is run.
I'm assuming there's more complexity that I haven't accounted for yet, such as managing Saver components across multiple scenes.
I was hoping a poke in the right direction might send me on my way?
I know this is a very specific implementation question, so my expectations are set that there's only so much help you can offer.
Many thanks again!