Some lectures ago I noticed that a bug had been introduced, but I don’t know when it happened and if it was something that I broke. To reproduce it I did the following:
- save
- kill a guy
- load
- the guy should be alive again but instead he was dead
- my max health and my level were not correct, they should be at the saved state but they were increased
- if I stopped the game and started again it was fine, all states were set correctly
I don’t know if it is addressed later in the course and even if anyone else has it, but I added the following code in my SavingWrapper in the Load() method and it seems fixed now:
public void Load()
{
GetComponent<SavingSystem>().Load(defaultSaveFile);
StartCoroutine(LoadLastScene()); // ADD THIS
}