How not to save a variable, but have it duplicated/persist when going into PIE mode ?

I actually did take a look, but there is no property flag to allow this. The reasoning is that we want PIE to be as accurate a representation of playing the game as possible, though a few shortcuts are taken to make it start as fast as possible (for example using duplication instead of saving to disk and reloading).

If you were to use instead of a UPROPERTY native serialization (overriding the ::Serialize function), you might be able to accomplish this with something like (and I haven’t tested this, but it might point you in the right direction).



void AMyClass::Serialize(FArchive& Ar)
{
   Super::Serialize(Ar);

   if (Ar.GetPortFlags() & PPF_DuplicateForPIE)
   {
      Ar << MyGiantArray;
   }
}


You can see an example of something like this in Landscape.cpp that was done for the open world demo. (https://github.com/EpicGames/UnrealEngine/blob/master/Engine/Source/Runtime/Landscape/Private/Landscape.cpp)