Update in AnimInstance like Event Blueprint Anim Update


I have a custom AnimInstance that access to some C++ Data. I extended that class with a blueprint, and I am currently using the method “Event Blueprint Update Animation” to calculate some values such as speed, direction…

I would like to move that blueprint code into the C++ class, but I don’t know where to include the code or if it will work while I keep using the Blueprint’s AnimGraph.

Should I put the code in UAnimInstance::UpdateAnimation?

UAnimInstance::UpdateAnimation can’t be overridden since it’s not vitual. But that method calls NativeUpdateAnimation(), which is the proper place to do this kind of updates.

void UAnimInstance::NativeUpdateAnimation(float DeltaSeconds)

So I only needed to extend that method

virtual void NativeUpdateAnimation(float DeltaSeconds) override;

I hope this helps.

Thanks good to know.