Hello,
We are implementing a save system to our game. I order to minimize memory impact we manually compress our actual save file “UOurSave” into another class “USaveContainer”. The container is then written to the disk.
See below:
UCLASS()
class UOurSaveGame: public USaveGame
{
};
UCLASS()
class USaveContainer: public USaveGame
{
UPROPERTY(SaveGame)
TArray<uint8> CompressedSave; // Contain a compressed version of UOurSaveGame. Will be loaded into the "SaveGame" field below
UPROPERTY()
TObjectPtr<UOurSaveGame> SaveGame;
};
The issue is that when the game start we do a “save discovery” process in the background, to find all the saves. But this causing a warning “The current loader ‘ZenLoader’ is unable to FlushAsyncLoading from the current thread ‘XXX’. Flush will be ignored.”
This is caused by the serialization of USaveContainer, triggering a LoadObject to load the UOurSaveGame class, that flush the async loads. But this class should not be included in the save file, as it is not flagged with the SaveGame UProperty.
Also note that we block Garbage Collection every time “LoadGameFromSlot / FromMemory” is called with FGCScopeGuard, and manually clear the Async flag from the returning UObject when we’re done, so that it can be collected afterward.
Adding the missing flag “Ar.ArIsSaveGame = true” in UGameplayStatics::LoadGameFromMemory() & UGameplayStatics::SaveGameToMemory() fixes the issue and prevent the log from occuring.
What is the reasoning behind not having the ArIsSaveGame flag in those function ?