UE: Iterating Through All Actor Properties for Sequence Recording
void AMyDrivingReplayActor::AddInterp(const UStruct* ObjectClass)
{
for (TFieldIterator<FProperty> It(ObjectClass); It; ++It)
{
It->SetPropertyFlags(CPF_Interp);
if (const FStructProperty* AsStructProperty = CastField<FStructProperty>(*It))
{
AddInterp(AsStructProperty->Struct);
}
}
}
Here, recursion sets the structs within this Actor that need recording to CPF_Interp. This property indicates that the value can be recorded by LevelSequence. This function iterates through all properties within the structs and also sets them to CPF_Interp
Also, because it is only called in BeginPlay, it does not affect properties in their normal state; it only changes these properties when the game starts
Thanks for reading. Feel free to like, follow, and bookmark, and discuss any questions in the comments.
If this article helped you, click here to donate and support the author.
