using UnityEngine; using UnityEngine.AI; public class RootMotion : MonoBehaviour { private NavMeshAgent _navMeshAgent; private void Start() { _navMeshAgent = GetComponentInParent(); } private void OnAnimatorMove() { transform.parent.position = _navMeshAgent.nextPosition; } }