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.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-203908 in the post.