AI stops playing animations when not seen by camera

My AI is made with blueprints, behavior trees and it has an animation blueprint. To reload, my AI has to crouch and then play the reload animation. The reload action is in the behavior tree, it forces AI controller to change isCrouching and isReloading bools, which are then being noticed by the animation blueprint and force Reload state in locomotion. Nothing special.

But there’s a problem. When the AI is far enough (like 2000 units) and is standing behind a cover, he crouches to reload and gets out of sight. Then he gets stuck in a crouched position, never updates his animation, never uncrouches, and continues to do what behavior tree says like shooting. And he’s shooting into the cover that’s in front of him.

This never happens if the player is close or I use unpossess to see what AI is doing from above. He updates his anims properly, so it isn’t a logic bug. I came to the conclusion that he stops playing any animation while being out of sight (I have a couple of other evidences).

This disrupts the AI behavior greatly as the distant AIs never uncrouch until I get close or flank them. Any solutions? How to force AI playing anims even if I don’t see him? Thanks.

Yeah, I have found an answer. Was a bit too quick with posting a question.

https://forums.unrealengine.com/development-discussion/animation/1611032-some-skeletal-mesh-animations-won-t-play-until-mesh-is-visible

If it is a SkeletalMeshComponent inside a blueprint then you can look at “Optimization” and “Visibility Based Anim Tick Option” in the Details tab and change the settings to “Always Tick Pose and Refresh Bones”.

4 Likes

Mate, it is 2023 now and your question - and more importantly, your answer with the solution, has just solved my mystery.
Thankyou,
Glyn Hodges