Play Anim Blueprint animation in editor viewport (not PIE)

Hi! I am curious if there a way to update anim blueprint graph animation in editor viewport? Maybe using AnimInstance or AnimInstanceProxy.

I found a way to update animation in viewport using Construction Script. If you set some variables using CS and send them to an animation blueprint then by evaluating CS you can update your anim instance. Like this:

But there is a problem. Every evaluation cycle in CS creates a new AnimInstance as well as other blueprint components:

I am afraid that this solution is not optimized and it creates a lot of trash in memory.

I found some functions like UAnimInstance::EvaluateAnimation() but they are all private or protected.

Can somebody help me?

I think that’s heavily protected to be called in editor. You’re correct that the construction script recreates anim instance.

Unfortunately I don’t know if there is any good way to fix this from blueprint. In native, whenever we want to update animation, we run specific sets of code to refresh animation. This is manual process so that we can avoid updating it in editor all the time. Try this if you want, but this will refresh whenever called.

    SkeletalMeshComponent->TickAnimation(0.f, false);
SkeletalMeshComponent->RefreshBoneTransforms();
SkeletalMeshComponent->RefreshSlaveComponents();
SkeletalMeshComponent->UpdateComponentToWorld();
SkeletalMeshComponent->FinalizeBoneTransform();
SkeletalMeshComponent->MarkRenderTransformDirty();
SkeletalMeshComponent->MarkRenderDynamicDataDirty();

Yoohoo!!! Thank you so much Lina!!! This is exactly what I was looking for! So easy ha:)) I wasted a lot of time with this problem.

Thank you, Lina! This totally solved a similar problem for me!

For any other future souls landing here: you can enable Skeletal Mesh → Update Animation in Editor on USkeletalMeshComponent's

Sadly, I need to control Update Animation in Editor via blueprint and this option only shows up after you drop it in viewport, not in the bp graph. What can be done, thanks!

1 Like