Save and Load Array from Game Slot

Hi all,
I’m trying to save an array of hits I’m creating with UI widget I’m working on.
The array contains Data Objects which contain (among other things) an assigned hit class.
Saving the hits seems to work fine - I’m saving the hits to an array in my save game object, I’m printing the return value of the save game to slot which prints True, and printing all the hit objects in the array to make sure they were added, which they have.
The problem is when loading the array from the saved game object it doesn’t work correctly - It contains all the Data Objects but the hits object inside of them are not valid.
Can anyone tell what I’m doing wrong?


Savegame 101

That’s what I’m doing.

There’s no create. There’s no load. I can’t debug it if I can’t see the code :wink:

Hi,
Sorry, I didn’t have time to get back to it.
So I did a couple of tests:

I saved the hits array from the UI and if the save is successful, I load the hits (in the same function) from the save file and print the hits - Which prints them and everything seems fine.
But, when the game starts and I load the hits (with the same load function) from the player character, the array is empty.

Does that helps more to understand?


Two things:

  1. You didn’t mention multi-player. I guess it could be something to do with that, and I know nothing about it.

  2. When you load the SG in the player, are you also using an unverified cast to the game instance? Does the cast actually work?

The cast works. And right now I’m testing in single player.