Got everything Implemented and its working for the most part. Im not getting any errors, my inventory is saving correctly, but When I go back to a scene with a dead enemy, all of the loot that enemy dropped respawns, as if it was never picked up…
The issue was with how my characters are updating upon reload. If they are supposed to be dead, when the scene loads, they update to the dead state, and the Death event is called, causeing the enemies to “Die” before the scene fades in… So when ever a scene loads, they die and spawn their loot. I fixed this by introducing a new bool state, called lootSpawned, that sets to true the first time the loot is spawned, and a new SpawnLoot event, that will only be called, when the lootSpawned is false. The lootSpawned state is captured and restored upon saving and loading respectively. This may have been a heavy hammer approach, but its working.
A clever solution, well done! In my own setup, I simply didn’t invoke the death event when the character was killed by RestoreState(). This means that you need to handle the animation and any disabling of colliders (if applicable) in a different method than the one that includes invoking the death animation. Less state to save, but there is nothing wrong with your approach.
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.