My animation is not playing

“WalkAnimation” is not playing but “Animation played” messeage is coming. Please help with my problem. Thanks :slight_smile:

        public class BotAI : MonoBehaviour
        {
            NavMeshAgent navigation;
            Animator anim;
            Transform target;
        
            void Start()
            {
                navigation = GetComponent<NavMeshAgent>();
                anim = GetComponent<Animator>();
            }
        
            void Update()
            {
                navigation.destination = target.position;
                chspeed = (transform.position - lastPosition).magnitude / Time.deltaTime;
                lastPosition = transform.position;
                if (chspeed >= 1.485f)
                {
                    anim.Play("WalkAnimation");
                    Debug.Log("Animation played")
                }
            }
        }

Assuming you have it named correctly try

anim.Play("Base Layer.WalkAnimation")

Personally I think you should look at using Parameters

In your animator controller create a bool parameter called “Walking”
Then create a transition between your idle and walking and set the condition to Walking true and a transition back from your walking to idle with the condition Walking false.

Then set that bool

anim.SetBool("Walking",true);

@MickyX still, not working