UClass values invalid after saving and loading in packaged game?
I'm creating a saving and loading system by serializing data via the FArchive class hierarchy and it works just fine in the editor.
When packaging I have encountered corrupted data however. I'm storing an actor in the following struct:
I assign the ActorClass value by using actor->GetClass() when storing an actor to records and in editor the value is always correct and works; in the packaged game, however, the value seems to be garbage sometimes. It can be "Invalid", it can be random classes of actors that I did not ever save etc. pp. As can be seen in the following image, the first and last entry in that array have wrong values.
The ActorNames are correct and the class should be similar to the name. So the first record's class should be B_Villager_C (or similar), just like with all other entries in the array. SavingTrigger and LoadingTrigger are values that did not ever get written to this array in the first place. The engine seems to mix some things up in the packaged version of the game.
This results in the packaged game crashing when accessing the saving system, but only sometimes. I have found that saving and loading the entire game in the first start-up leads to a crash. However, when I start the game again, then load the save that I tried to load in the prior instance of the game, it works.
The entire saving system is in the GameInstance. The initial reading of the save game file is correct and the data entries in the save file indicate the correct classes, too. It's just that something gets written into the array at run-time, it looks like. The error also seems to exclusively exist in the UClass * ActorClass, as all other values of the FActorRecord seem to be correct entirely.
asked Mar 16 '18 at 12:19 PM in C++ Programming
Follow this question
Once you sign in you will be able to subscribe for any updates here