I recently got a warning from FAnimInstanceProxy::PostUpdate, triggered by this line:
// FAnimInstanceProxy::PostUpdate
if (ensureMsgf(Messages, TEXT(“PreUpdate isn’t called. This could potentially cause other issues.”)))
What I’ve been trying to do, is to bind spawned characters to a cinematic sequence in runtime. The actor binding seems to work fine. But soon after the actor was bound to sequence, the warning was fired from FAnimInstanceProxy::PostUpdate. I spent a bit time looking into USkinnedMeshComponent ticking code. Basically the warning means that the proxy PreUpdate is supposed to be called before the PostUpdate but it wasn’t.
The code paths for PreUpdate and PostUpdate:
PreUpdate:
USkinnedMeshComponent::TickComponent
USkeletalMeshComponent::TickPose
USkeletalMeshComponent::TickAnimation
UAnimInstance::UpdateAnimation
UAnimInstance::PreUpdateAnimation
FAnimInstanceProxy::PreUpdate
PostUpdate:
USkinnedMeshComponent::TickComponent
USkeletalMeshComponent::RefreshBoneTransforms
USkeletalMeshComponent::DispatchParallelEvaluationTasks
…
We have “Enable Update Rate Optimization” turned on in the skeletal mesh component. What I saw in my debugger: soon after the sequence started playing, a TickAnimation call in TickPose was skipped (due to the ShouldTickAnimation check, which returned false because of that “optimization” setting). However, there is no such a check in the RefreshBoneTransforms call (in the USkinnedMeshComponent::TickComponent, behind the TickPose call). As a result, PostUpdate was called without PreUpdate being called first.
Also, I noticed that the ShouldTickAnimation check is present in DispatchParallelTickPose (another code path from which PostUpdate could be triggered).
So why is the ShouldTickAnimation check absent in RefreshBoneTransforms ?