Save and load not working

4.7.6

Windows 7 64bit

Saving and loading:

  • works in PIE
  • does not work in packaged windows 32 shipping
  • does not work in packaged windows 64 development

can you give us screenshot of a blueprint that does saving and loading?

Hi Taisaku,

I was successfully able to save and load in a packaged game for windows using 4.7.6. As wmbuRn asked, can you show us your Blueprint setup? Thanks!

MyGameInstance::TrySavePlayerData()

How are you verifying that save/load isn’t working?

Did you know that release (and I think development) packaged builds put save game files into a different location than PIE and debug builds? Maybe you’re just looking in wrong directory?

  • PIE/debug builds save here next to build and/or project files in a Saved directory

  • release builds save games into directory returned by FPlatformProcess::UserSettingsDir(); for 4.7 on Windows, that’s something like:

    C:\Users<User>\AppData\Local<UE4 Project Name>\Saved\SaveGames

I’m not comparing save data between PIE and packaged. I fully expect those to be separate.

In game i make modifications to player data and save to disk, then make more modifications and load which overwrites game data with save data.

Additionally i compare save data from one session to next.

In PIE saves work in a single session but are wiped between fresh game instances, which is to be expected.

But in a packaged game saves are also wiped between fresh game instances which means data is not being saved to disk.

Save location is whatever default engine save locations are. I am not using any custom save functions.

Hi Taisaku,

This same setup works (always prints “Game Saved Successfully”) in a packaged project for me. You mentioned below that saves are wiped between instances of PIE; that shouldn’t be happening. If you load data from a previous PIE before overwriting it, it should remain intact. An easy way to test this is to move Character pawn on Begin Play to a vector saved in SaveGame. Save, quit, PIE, and character should move to saved vector. Is that not happening for you?

Does this happen in a new project as well, or only your current project?

In a new third person project

works fine.
In my current project if i run

on startup in PIE it says ‘New Save Created’ and ‘Game Saved Successfully!’ every time.

So even if it saves and loads fine while running, when you close it and reopen old save is gone.

Well sure, you’re overwriting save when you do that. If you don’t run that, and instead grab a value saved in SaveGameInstance from previous PIE session, it should give you value. That should work both for PIE and for packaged games. If I’m not being clear, I’ll take a couple screenshots when I get to office tomorrow.

Thanks , you are correct.

My order of operations was overwriting data. Here’s my working setup if any one is curious.