Hi,
I’m having problems trying to “pass” or copy the data in an FBufferArchive to a variable that is using an external library. The idea is to serialize the save game data into a variable (FBufferArchive) in order to pass it to a variable (Vector<uint8_t>) in the library I’m using to be able to recover that info later and load the save game data using a FMemoryReader.
SaveGame.h
FBufferArchive ToBinary;
SaveGame->Serialize(ToBinary);
#if PLATFORM
Vector<uint8_t> SaveData;
*(reinterpret_cast<FBufferArchive*>(SaveData())) = ToBinary; // That doesn't work because I can't use the operator = with a FBufferArchive
...
...
#endif
GameInstance.h
#if PLATFORM
var inital_state = GetInintialState(); //I'm putting this in that way because I don't know if I can put the real API calls.
if(!initial_state.data.empty()
{
FBufferArchive RecoverBinaryData;
RecoverBinaryData = *(reinterpret_cast<FBufferArchive*>(initial_state.data)); // Of course this also doesn't work.
FMemoryReader FromBinary = FMemoryReader(RecoverBinaryData, true);
FromBinary.Seek(0);
SaveGame->Serialize(FromBinary);
}
#endif
I tried everything I could related with the big three (FBufferArchive, FMemoryReader and FArchive) but I can’t assign the info of the bufferarchive to another variable in order to set the API variable…
What am I missing? Any idea of how I could get this work?!
Thanks.