Delete save game from memory?

If i delete my save game ingame, and save again with similar name, and then loading, there is remain (not overwrited) data in the new save game from the old.
If i close the game after deleted save, and restart, then works fine.

I checked, the .sav file was deleted.

How can i fix this problem?

Thanks.

This really depends how you handle SaveGame…
I could guess you use GameInstance as an airlock for your datas(which seems to be the common and best practice).
IE :

  • Set the data you desire to save in GameInstance
  • Tell SaveGame to grab data from GameInstance
  • Write the datas to .sav

If you want to reset you’d have to do something like:

  • Erase .sav
  • Reset datas to default in GameInstance

Hi, thanks.

I’m not use gameInstances, because this is a simple, 1 level game. I save direct to savegame, and load from that.

In any cases, you have to reset the datas. Erasing the .sav is not enough, think about the process as the exact inverse than saving.
In fact you’re virtualy loading a default SaveGame.

Saving :

  • Get HP from Player
  • Set HP in BP_SaveGame
  • Write .sav

Reseting:

  • Erase .sav
  • Reset Default HP in Player

I tried to reset value after erase .sav, tried to override .sav file with resetted values.
If i modify any other value in the save file, and load back, its load back the other (reseted) variables too.
If i reload (Open level node) this level, its works fine after delet .sav file.

We do this by setting information in the Game Instance, saving it to the save file, reloading all information in the game instance from the save file then repopulating everything that needs repopulated on screen.

However, if you change information in the editor and you update your default save game info, that is not going to overwrite an existing .sav file. You will need to go into explorer manually and delete the .sav before starting a new game.