using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.AI; public class NPCMovementAnimator : MonoBehaviour { [SerializeField] private Animator animator; [SerializeField] private NavMeshAgent agent; private void Update() { var speed = agent.velocity.magnitude / 3f; speed = Mathf.Clamp(speed, 0f, 1f); animator.SetFloat("Speed",speed); } }