using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.AI; public class Boat : MonoBehaviour { private NavMeshAgent agent; private void Awake() { agent = GetComponent(); } private void Update() { if (Input.GetMouseButtonDown(0)) { var ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 1000f)) { agent.SetDestination(hit.point); } } } }