using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.AI; [RequireComponent(typeof(NavMeshLink))] public class UpdateNavMeshLink : MonoBehaviour { public Transform from; public Transform to; private NavMeshLink m_Link; private void Awake() { m_Link = GetComponent(); } private void Update() { if (from == null || to == null) return; m_Link.startPoint = transform.InverseTransformPoint(from.position); m_Link.endPoint = transform.InverseTransformPoint(to.position); } }