That's just the way loading works. The scene starts the way you designed it. In the first frame, the save system applies the changes recorded in the saved game. You can mask this by covering the whole screen with a black texture. Add a Sequence Trigger set to OnStart that deactivates the whole-screen cover and running a Fade(in) sequencer command.supadupa64 wrote:Before I dive into those other things you suggested, I did notice this one thing. When I'm loading a game the player ports to the very start of the game, then to the spot where he is supposed to be.
Sounds like the current scene's Increment On Destroy components are still triggering.supadupa64 wrote:I was watching the quests that are being tracked in the top of the screen and noticed that if I was on a quest collecting 10 scrolls and I had currently collected 5/10, on a frame in between the loading it says something like 8/10 collected or 9/10 collected. I saw it change a couple times which probably is the cause of this alert being shown on load.
Do you know how this could happen?
When you load a game, this happens:
- Unity invokes OnDisable and OnDestroy on all enabled components on active GameObjects in the current scene.
- Unity unloads all GameObjects in the current scene.
- Unity loads all GameObjects in the saved game's scene. (This may be the same scene as the current scene, but Unity still follows this process.)
- Unity invokes Awake and Start.
To address this, the Dialogue System can tell all current components (such as Increment On Destroy) to ignore the next OnDisable/OnDestroy. Internally, to do this you invoke PersistentDataManager.LevelWillBeUnloaded. It sounds like, however you're loading your game, it's not invoking PersistentDataManager.LevelWillBeUnloaded.
If I recall correctly, you're using the Dialogue System Menu Template prefab. If this is the case, make sure your Dialogue Manager GameObject has a Level Manager component. This component takes care of invoking PersistentDataManager.LevelWillBeUnloaded.
However, if you're using a loading scene, you'll want to make this change to SaveHelper.cs:
Change this: (starting line 145)
Code: Select all
if (useLoadingScene)
{
LoadingScene.SetLoadGameData(saveData);
SceneManager.LoadScene(loadingSceneIndex);
}
Code: Select all
if (useLoadingScene)
{
LoadingScene.SetLoadGameData(saveData);
PersistentDataManager.LevelWillBeUnloaded(); //<--ADD THIS.
SceneManager.LoadScene(loadingSceneIndex);
}