I’m posting this as an answer because I can’t fit the entire text in a comment for some reason. Whenever I try to call Serialize() on an actor it ignores the variables even with the save game property/flag. But when I try to serialize variables manually by using the << operator it crashes and gives me an assertion failed error. Same whether ArIsSaveGame is set to true or false. I don’t know what I’m doing wrong. If you have any idea please help. Thanks!
Error:
Assertion failed: 0 [File:D:\Windows\Program Files (x86)\UE_4.25\Engine\Source\Runtime\Core\Public\Serialization/MemoryArchive.h] [Line: 56]
0x00007ff847bc3b29 KERNELBASE.dll!UnknownFunction []
0x00007fffbb24ec66 UE4Editor-Core.dll!UnknownFunction []
0x00007fffbb252048 UE4Editor-Core.dll!UnknownFunction []
0x00007fffbafde52d UE4Editor-Core.dll!UnknownFunction []
0x00007fffbaf697c5 UE4Editor-Core.dll!UnknownFunction []
0x00007fffbaf6bb00 UE4Editor-Core.dll!UnknownFunction []
0x00007fff8ada7b7e UE4Editor-SkitzSaveSystem-6352.dll!FMemoryArchive::operator<<() [D:\Windows\Program Files (x86)\UE_4.25\Engine\Source\Runtime\Core\Public\Serialization\MemoryArchive.h:56]
0x00007fffbb077472 UE4Editor-Core.dll!UnknownFunction []
0x00007fffcd81019d UE4Editor-CoreUObject.dll!UnknownFunction []
0x00007fffcd811df2 UE4Editor-CoreUObject.dll!UnknownFunction []
0x00007fffcd6bbc35 UE4Editor-CoreUObject.dll!UnknownFunction []
0x00007fffcd6b9b7c UE4Editor-CoreUObject.dll!UnknownFunction []
0x00007fffcd79c884 UE4Editor-CoreUObject.dll!UnknownFunction []
0x00007fffcd79aeba UE4Editor-CoreUObject.dll!UnknownFunction []
0x00007fffcd79a9cb UE4Editor-CoreUObject.dll!UnknownFunction []
0x00007fffb3b7aaed UE4Editor-Engine.dll!UnknownFunction []
0x00007fffb4b7719e UE4Editor-Engine.dll!UnknownFunction []
0x00007fff8adabb54 UE4Editor-SkitzSaveSystem-6352.dll!UC_SaveComp::GetActorStructure() [D:\Documents\Unreal Projects\PluginDevelopment\Plugins\SkitzSaveSystem\Source\SkitzSaveSystem\Private\Objects\C_SaveComp.cpp:118]
0x00007fff8adaf30b UE4Editor-SkitzSaveSystem-6352.dll!UC_SaveComp::SaveActor() [D:\Documents\Unreal Projects\PluginDevelopment\Plugins\SkitzSaveSystem\Source\SkitzSaveSystem\Private\Objects\C_SaveComp.cpp:66]
0x00007fff8adbc571 UE4Editor-SkitzSaveSystem-6352.dll!UC_SaveComp::execSaveActor() [D:\Documents\Unreal Projects\PluginDevelopment\Plugins\SkitzSaveSystem\Intermediate\Build\Win64\UE4Editor\Inc\SkitzSaveSystem\C_SaveComp.gen.cpp:50]
0x00007fffcd5e0b34 UE4Editor-CoreUObject.dll!UnknownFunction []
0x00007fffcd8300ad UE4Editor-CoreUObject.dll!UnknownFunction []
0x00007fffcd8530e3 UE4Editor-CoreUObject.dll!UnknownFunction []
0x00007fffcd85571d UE4Editor-CoreUObject.dll!UnknownFunction []
0x00007fffcd823bba UE4Editor-CoreUObject.dll!UnknownFunction []
0x00007fffcd855362 UE4Editor-CoreUObject.dll!UnknownFunction []
0x00007fffcd85571d UE4Editor-CoreUObject.dll!UnknownFunction []
0x00007fffcd854c24 UE4Editor-CoreUObject.dll!UnknownFunction []
0x00007fffcd5e0b34 UE4Editor-CoreUObject.dll!UnknownFunction []
0x00007fffcd854753 UE4Editor-CoreUObject.dll!UnknownFunction []
0x00007fffb3b6afe5 UE4Editor-Engine.dll!UnknownFunction []
0x00007fff8adba599 UE4Editor-SkitzSaveSystem-6352.dll!AGlobalSaveActor::SaveAll() [D:\Documents\Unreal Projects\PluginDevelopment\Plugins\SkitzSaveSystem\Intermediate\Build\Win64\UE4Editor\Inc\SkitzSaveSystem\GlobalSaveActor.gen.cpp:128]
0x00007fff8adb094c UE4Editor-SkitzSaveSystem-6352.dll!USkitzSaveLibrary::SkitzSaveAll() [D:\Documents\Unreal Projects\PluginDevelopment\Plugins\SkitzSaveSystem\Source\SkitzSaveSystem\Private\Libraries\SkitzSaveLibrary.cpp:22]
0x00007fff8adbec35 UE4Editor-SkitzSaveSystem-6352.dll!USkitzSaveLibrary::execSkitzSaveAll() [D:\Documents\Unreal Projects\PluginDevelopment\Plugins\SkitzSaveSystem\Intermediate\Build\Win64\UE4Editor\Inc\SkitzSaveSystem\SkitzSaveLibrary.gen.cpp:201]
0x00007fffcd87a605 UE4Editor-CoreUObject.dll!UnknownFunction []
0x00007fffcd85571d UE4Editor-CoreUObject.dll!UnknownFunction []
0x00007fffcd854c24 UE4Editor-CoreUObject.dll!UnknownFunction []
0x00007fffcd5e0b34 UE4Editor-CoreUObject.dll!UnknownFunction []
0x00007fffcd854753 UE4Editor-CoreUObject.dll!UnknownFunction []
0x00007fffb3b6afe5 UE4Editor-Engine.dll!UnknownFunction []
0x00007fffb43fb5e8 UE4Editor-Engine.dll!UnknownFunction []
0x00007fffb43dc810 UE4Editor-Engine.dll!UnknownFunction []
0x00007fffb43f8adb UE4Editor-Engine.dll!UnknownFunction []
0x00007fffb8ceaf57 UE4Editor-UnrealEd.dll!UnknownFunction []
0x00007fffb95c37e6 UE4Editor-UnrealEd.dll!UnknownFunction []
0x00007ff654ca7800 UE4Editor.exe!UnknownFunction []
0x00007ff654cbba7c UE4Editor.exe!UnknownFunction []
0x00007ff654cbbb5a UE4Editor.exe!UnknownFunction []
0x00007ff654cce31d UE4Editor.exe!UnknownFunction []
0x00007ff654cd145a UE4Editor.exe!UnknownFunction []
0x00007ff84a9f7c24 KERNEL32.DLL!UnknownFunction []
0x00007ff84abacea1 ntdll.dll!UnknownFunction []
Component CPP:
FMemoryWriter MemoryWriter(ActorStructure.Variables);
MemoryWriter.ArIsSaveGame = bUseSaveGameFlags;
GetOwner()->Serialize(MemoryWriter);
FString Dir = FPaths::ProjectContentDir();
Dir.Append(TEXT("/Data.txt"));
FFileHelper::SaveArrayToFile(ActorStructure.Variables, *Dir);
Another Actor CPP:
FBufferArchive BinaryData;
BinaryData << InSaveInfo;
FFileHelper::SaveArrayToFile(BinaryData, *FileDirectory);
struct << Operator Definition:
friend FArchive& operator<<(FArchive& Ar, FSaveStructure& SaveInfo)
{
Ar << SaveInfo.SaveName;
Ar << SaveInfo.FileDirectory;
Ar << SaveInfo.AuthorName;
Ar << SaveInfo.Thumbnail;
Ar << SaveInfo.GameState;
Ar << SaveInfo.GameVersion;
Ar << SaveInfo.DateCreated;
Ar << SaveInfo.Progress;
return Ar;
}