Then, write an implementation in the global scope (so without namespace::), in the .cpp:
FArchive& operator<< (FArchive& Ar, FTestLocation& Struct) {
Ar << Struct.Value;
Ar << Struct.Transfrom;
Ar << Struct.Value2;
return Ar;
}
With this, any FArchive will correctly, in the same order, serialize and deserialize your struct to/from binary, just call SomeFArchive << MyFTestLocation, thanks to the fact that almost all Unreal types, such as FTransform, FVector, etc. have the operator<< overloaded already. You don’t have to worry about their internal structure, sizeof, things like that at all.
Thanks for the reply, yes the solution you suggested could resolve my issue.
But what I am working on is a templated solution using SerializeBin to work on all the UStruct, so Ideally I’d love to have something works without adding any new code.
Also, I am new to Unreal Engine, I am not sure if I am not using SerializeBin correctly, or this is a bug on SerializeBin? (I am going to dig into the implementation a bit later.)