Values stored inside variables becomes corrupted after creating an FBufferArchive variable (FBufferVar), setting FBufferVar.ArForceByteSwapping = true; and then storing the original value in FBufferVar

Steps to Reproduce
  1. Open UE4Editor (any project)
  2. Add code to project based on Actor (MyActor)
  3. Add the following to the Tick function in the .cpp file
    float foo = 1234.56789e+20;
     FBufferArchive ar;
     UE_LOG( LogTemp, Warning, TEXT( "Original value: %g" ), foo );
     ar << foo;
     UE_LOG( LogTemp, Warning, TEXT( "Before Serialization: %g" ), foo );
     ar.ArForceByteSwapping = true;
     ar << foo;
     UE_LOG( LogTemp, Warning, TEXT( "After Serialization: %g" ), foo );
  4. Compile the code
  5. Create a blueprint based on MyActor (MyActorBP)
  6. Add instance of MyActorBP to the level and PIE

Original & Before serialization values are equal however the value of foo printed to the output log changes after setting ar.ArForceByteSwapping = true;

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

Login to Vote

Won't Fix
ComponentUE - Foundation - Core
Affects Versions4.10
CreatedNov 16, 2015
ResolvedAug 18, 2021
UpdatedAug 18, 2021