void UPhysicsConstraintTemplate::Serialize(FArchive& Ar) { #if WITH_EDITOR FConstraintProfileProperties CurrentProfile = DefaultInstance.ProfileInstance; //Save off current profile in case they save in editor and we don't want to lose their work if(Ar.IsSaving() && !Ar.IsTransacting()) { DefaultInstance.ProfileInstance = DefaultProfile; } #endif Super::Serialize(Ar); // If old content, copy properties out of setup into instance if(Ar.UE4Ver() < VER_UE4_ALL_PROPS_TO_CONSTRAINTINSTANCE) { CopySetupPropsToInstance(&DefaultInstance); } if(!Ar.IsTransacting()) { //Make sure to keep default profile and instance in sync if (Ar.IsLoading()) { DefaultProfile = DefaultInstance.ProfileInstance; } #if WITH_EDITOR else if(Ar.IsSaving()) { DefaultInstance.ProfileInstance = CurrentProfile; //recover their settings before we saved } #endif } }
void UPhysicsConstraintTemplate::Serialize(FArchive& Ar) { Super::Serialize(Ar); // If old content, copy properties out of setup into instance if(Ar.UE4Ver() < VER_UE4_ALL_PROPS_TO_CONSTRAINTINSTANCE) { CopySetupPropsToInstance(&DefaultInstance); } }