Hello,
My game revolves around areas that can change fairly drastically depending on what conditions have been met. Not sure if this is best practice necessarily, but the solution I landed on was having a "base" scene, and then any permutations are stored in separate scenes that I add on top of the base with an additive scene load when the player first enters the base scene. These loads are stored in dialogue system triggers on a main controller that triggers a LoadLevel sequence on start if the proper conditions are met.
However, this was causing issues because with the save system active, LoadLevel executes SaveSystem.LoadAdditiveScene, which adds the scene to an m_addedScenes list, preventing the additive scene from being loaded again if I reload the base scene. Not adding the additive scene to that list solved the issue.
So, I'm not super familiar with how the save system works, so before I continue forward with this approach, I wanted to ask -- what is the purpose of m_addedScenes? Will I be causing further headaches down the line if I don't add to that list? Would a better solution be to write some kind of custom LoadLevel sequence that first calls UnloadAdditiveScene?
Any guidance would be appreciated.
Thank you!
Purpose of m_addedScenes in LoadAdditiveScene?
Re: Purpose of m_addedScenes in LoadAdditiveScene?
Hi,
m_addedScenes keeps track of which scenes have been additively loaded to prevent them from being loaded a second time.
Before reloading the base scene, call PixelCrushers.SaveSystem.UnloadAdditiveScene() to unload the additively-loaded scene.
Or import this patch (which will be in the next full release, too):
PixelCrushers_SaveSystemPatch_2020-09-11.unitypackage
and set:
Then when you change scenes (e.g., using LoadLevel()), it will automatically unload any additively-loaded scenes that you've loaded with SaveSystem.LoadAdditiveScene().
m_addedScenes keeps track of which scenes have been additively loaded to prevent them from being loaded a second time.
Before reloading the base scene, call PixelCrushers.SaveSystem.UnloadAdditiveScene() to unload the additively-loaded scene.
Or import this patch (which will be in the next full release, too):
PixelCrushers_SaveSystemPatch_2020-09-11.unitypackage
and set:
Code: Select all
PixelCrushers.SaveSystem.autoUnloadAdditiveScenes = true;
Re: Purpose of m_addedScenes in LoadAdditiveScene?
The patch works like a charm. Thanks Tony!
Re: Purpose of m_addedScenes in LoadAdditiveScene?
Great! Happy to help.