I've made recording showing the problem. The idle is working well but when I start moving, the walk animation is glitching out. Code (CSharp): using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.AI; public class CharacterAnim : MonoBehaviour { Animator animator; NavMeshAgent agent; void Start() { animator = GetComponentInChildren<Animator>(); agent = GetComponent<NavMeshAgent>(); } void Update() { float speedPercent = agent.velocity.magnitude / agent.speed; animator.SetFloat("speedPercent", speedPercent); } }
I'm not sure what the problem is, but even if you got this approach working properly it would still be much better to use a blend tree for this. Just a simple 1D blend tree containing the two animations and using the speed parameter to blend between them.