unity navmeshagent set destination
// To use this script, you need a set-up navmesh surface.
// Attach this script onto a navmesh agent.
using UnityEngine;
using UnityEngine.AI;
public class SetDestination : MonoBehaviour {
public Transform target;
NavMeshAgent agent = GetComponent();
void Update(){
agent.SetDestination(target.position);
}
}
|