FAnimInstanceProxy::PostUpdate warning: PreUpdate isn't called

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 ?

I believe this is fixed but it’s not in 4.20. It will be in 4.21:

In CL 4272085, we removed from AnimCustomInstance.h:
SequencerInstance->bNeedsUpdate = true;

This was after adding CL 4222199 (which is in 4.20). That forces sequencer to tick the animation again if it’s already been ticked. This is to fix issues like when sequencer binds to a skeleton after it’s already been ticked that frame.

Hope this helps.