Deserialize Version of UStruct::SerializeBin


we have been looking at a couple of serialization options of USTRUCTs and found the SerializeBin method which appears to conveniently and recursively serialize the USTRUCT using the FBufferArchive. However, looking through the code I was not able to find a DeserializeBin method which also recursively deserializes the binary back into a USTRUCT.

Is there such a thing?

If an automatic deserialize solution like the JsonObjectConverter is neither available nor possible, what would be the best alternative? Implementing an IStructDeserializerBackend for the binary data or implementing the operator<< method on all structs to be able to use a FMemoryReader?


Hi Andre,

All of UE4’s Serialize functions are dual operation - they work on both readers and writers. If you call SerializeBin with a reader archive instead of a writer archive, it will deserialise for you:

TArray Storage;
UStruct* MyStruct = FMyStruct::StaticStruct();

FMyStruct Before;
FMemoryWriter ArWriter(Storage);
MyStruct->SerializeBin(ArWriter, &Before);

FMyStruct After;
FMemoryReader ArReader(Storage);
MyStruct->SerializeBin(ArReader, &After);

// Before and After should now be equal

Hope this helps,


It helped, thanks!