Enemy not resetting on reload

I have the saving system working as shown in the videos, and I found another thread on this issue, but the solution presented in that thread, didn’t work for me…
My issue is if I save after killing an enemy, that enemy stays dead on reload, but so do all of the other enemies I killed, after saving. If I load a fresh start, the reload, the correct enemies are dead, the correct enemies are still alive, but not if I reload during runtime. It was ambiguous as to weather this was address later in the course, so I just wanted to check if there is an official fix for this. Thanks.

1 Like

Hi, sorry for missing this question.

The trouble with the L)oad key in the game is that we’re not truly resetting the state of anything to a known “starting” value before applying changes. That means that our dead characters, though brought back to life at load, are still in an animation state that renders them dead.
The solution to the problem lies in the Loading Key itself in SavingWrapper.

Leave Load() as is, since Portal needs it just as written. Note that when Portal opens a scene, it starts with a fresh copy of the scene into a “known” state, so the Load makes sense and creates no undead zombies throughout our scene.

Make the following change to the SavingWrapper.Update in the block that checks for Loading. Replace the method call Load() with:

StartCoroutine(LoadLastScene());

This will reload the scene and force the saving system to restore the game correctly. No more Zombies I hope this helps.

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms