So ive been workin on save games, and so i tried out rama’s way of doing this.
However with FBufferArchive’s << operator not working anymore, i have no clue what todo and cant find any solution here or in the API, i was wondering if there was a solution to this and what that would be.
i was also wondering if i would be able to save a customer UObject inhertited class as a whole or do i need to save all members seperatly?
i hope to hear from you from soon, and thank you for your time ^^.
You have savegames within blueprints, does that satisfy your needs? Otherwise you can probably look into that code on how to do it!
well, im since i posted this in the C++ blueprint saving isnt something i wanna do at all, not just that but id rather not use the UE4 saving method using the savegame objects and all. The reason im asking about a solution of the rama guide that doesnt work anymore, is couse i wanna use that rather then the UE4 way. thanks for your response tho!
Where did you read that FBufferArchive’s << operator doesn’t work anymore? I’m not sure about FBufferArchive, but I’ve always used FArchive which as of 4.11.2 still supports the << operator. Here is how I write things to disk using FArchive:
const TCHAR* TargetPath = TEXT("MySaveFile.dat");
FArchive* FileWriter = IFileManager::Get().CreateFileWriter(TargetPath);
int32 SomeInt = 123;
float SomeFloat = 123.456f;
*FileWriter << SomeInt;
*FileWriter << SomeFloat;
FileWriter = nullptr;
To load it from disk again the syntax is the same, using the << operator, but the FArchive is initialized in read mode:
FArchive* FileReader = IFileManager::Get().CreateFileReader(TargetPath);
About your question about whether you are able to save a UObject at once. Yet, but this is exactly the purpose of the SaveGame system which mentioned. It is possible to use this without touching blueprint, the blueprint nodes are C++ functions, after all. See the commentary in the engine’s SaveGame.h for how to save a UObject at once.
Well in the code for the << operator is this:
// Not supported through this archive
but i will try the code you provided ^^ ill come back with a response soon.