I am trying to make my game remember the level state between deaths.
Right now, it works as follows:
Collected items and destroyed objects are stored in the game state temporarily.
When the player reaches a checkpoint, items and objects are pushed to the game instance so that they can be removed from the level if the player dies and counted on level completion
At the end of the level, objects and items on the game instance are saved to a save file.
Retrieving variables on respawn isn’t normally an issue, for some reason the array of objects is empty when I try to retrieve it from the game instance after respawning.
Maybe a silly question, but as I understand: Your have an array of objects right? And correct me if im wrong but wouldnt these objects and actors you are referencing to, removed after reloading your level?
That makes a lot of sense. I was trying to avoid saving to a file just because I’ve had so much confusion with it in the past but now that you say that, I’m not sure how it could be done any other way. Thanks!