Bug in save load system.

I find bug in save load system.

I had creare varibel in class:

UPROPERTY(EditAnywhere, BlueprintReadWrite, SaveGame)
		int32 Par;

In class constructor I set value 5. In editor In property I set value 0. If in game i set value 5 and save game. After loading from file value Par is 0 (How value in property), but must be five.

If I set Par value 3,4,6,7, everything works correctly, but if set value equal constructor value it take incorrect value. Data from file I load with help serialization class.

    FMemoryWriter MemoryWriter(ObjectData, true);
	FObjectAndNameAsStringProxyArchive Ar(MemoryWriter, false);

	Ar.ArIsSaveGame = true; //Set achive is savegame
	Object->Serialize(Ar);

For exaple I add my progect link text .

Control:
s - Save
l - Load
i - Increment Par
p - Print Par on screen.

Hey Deema_35-

How are you setting up your save/load feature? If you’re able to reproduce this issue, can you provide the setup steps to help me investigate the issue locally?

Hey. I’m not sure I understood the question. That’s what I’m doing:

  1. Create new class. Create new var int (Name Par) in class with property specifiers (EditAnywhere, BlueprintReadWrite, SaveGame)

  2. Creaate class constructor with Par = 5;

  3. In editor property set Par = 0;

  4. In game set Par = 5;

  5. Save game;

  6. Load game. After load Par = 0 (must be 5);

Save game

  1. Create achive for save

      FMemoryWriter MemoryWriter(ObjectData, true);
      FObjectAndNameAsStringProxyArchive Ar(MemoryWriter, false);
    
      Ar.ArIsSaveGame = true; //Set achive is savegame
    
  2. Serializ my class instance:

    Object->Serialize(Ar);

Load game:

  1. Create achive for load

      FMemoryReader MemoryReader(ObjectData, true);
      FObjectAndNameAsStringProxyArchive Ar(MemoryReader, false);
    
      Ar.ArIsSaveGame = true; //Set achive is savegame
    
  2. Serializ my class instance:

    Object->Serialize(Ar);

ObjectData this TArray witch I from file.

TArray<uint8> ObjectData;

But my Exampel project dont help you?

Hey there, someone else had the same issues (which I also run into) and this fixed it for me

Epic - there are a few threads like this (eg Unexpected behavior with SaveGame - Editor Scripting - Unreal Engine Forums), it seems like the SaveGameToSlot and related functions in UGameplayStatics maybe should be ignoring default deltas by default or at least give us a bool flag to make it do that, instead of having to rewrite those functions again? Its a very subtle error that could easily be missed and its not something most would expect would be an issue.

Thank you! This is work

         ArNoDelta = true;