As the title says. I thought I’d experiment a bit with saving and loading in certain conditions, and I noticed this: if I reload after the player has died, the health will be restored correctly to the value iot was when I last saved, but the player is stuck in the “dead” pose and the NavMeshAgent is disabled.
I thought “of course, I am not resetting the bool and the stuff we disabled on death, and the death animation has no exit”, so I tried to monkey with that but it caused issues with enemies dying. So I thought that the bruteforce approach would solve it and tried to reload the scene on hitting S rather than just restoring the state from save, but the problem persists.
Is this addressed sometimes down the line of the course, or is it only me who has this issue?
When the S and L keys were first introduced, it was more for a prototyping purpose than for an end user experience. As such, many of the bells and whistles that would have to happen to truly restore a scene were left out. The easiest way to accomplish this is to reload the last scene, like we do in the Start() of SavingWrapper… in fact, the easiest way to reload the scene properly is to change the contents of Load() in SavingWrapper to read:
void Load()
{
StartCoroutine(Start());
}
That’s (kind of) what I tried, but it didn’t work. This morning I remembered that we put a check in SaveSystem’s method that prevents reloading if the scene index is the same as the current index. You have to remove that for savegames to reload properly.
Which goes to show one should never code late in the evening if he’s not a night owl
Yeah, I think ultimately, we remove that sanity check from the LoadLastScene() (or perhaps that’s just my copy of the script).
The trouble with restoring without reloading the scene is that it ultimately leaves us checking a large number of things, much like the state of a character that was dead but is now alive. It’s simpler just to reload the scene (and if the scenes are designed well, then it shouldn’t cause too much in the way of excess loading times - when a player presses “L”, there is an expectation that there may be a bit of reloading involved).
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.