FVariant is a struct that implements a union of data types, including FVector. When assigning an FVariant an FVector value in engine versions UE 4.27 or earlier, the FVariant will deserialize incorrectly in UE 5.0 and later.
The cause for this is the move to Large World Coordinates, so FVectors which had float components before now have double components. FVariant's serialization does not account for this, since it serializes its underlying data as a byte array and for FVectors interprets the old 12 byte (float float float) data as 24 byte (double double double). This results in local data corruption: FVariants that store FVectors in SaveGames and possibly other serialization areas are deserialized with changed values, though the changed data has no direct effect on stability.
For the time being, users can fix-up deserialized FVariants, for example in their SaveGame::Serialize like this:
// Here MyVariant is (and must be) an FVariant storing an FVector value and serialized in UE 4.27 or earlier. const uint8* BinaryDataAddress = MyVariant.GetBytes().GetData(); const FVector3f OldVector = *reinterpret_cast<const FVector3f*>(BinaryDataAddress); const FVector NewVector = FVector(OldVector); MyVariant = NewVector;
However, for future engine versions it would be better if the fix-up of pre-UE5 FVariants happens automatically.
New project repro steps:
UE 4.27 repro project available.
I am not able to find world outliner how to enable it?
How can i modify the param name in EQS node
Undefined sysmbol: typeinfo for AActor when cross-compile linux dedicated server on windows
Delay nodes occasionally don't fire the "Completed" output in a nativized build
Teleporter in the Creative Hub is Locked and cannot be accessed
How to achieve HLSL Multiple Render Target in Material blueprints?
What property of the Slider is the image used when dragging?
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-203908 in the post.