Unity NavMeshagent Set Tujuan

// 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<NavMeshAgent>();
  
  void Update(){
    agent.SetDestination(target.position);
  }
}
codingiscool