using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.AI; public class player_move : MonoBehaviour { // Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { //1.ray Ray r1 = Camera.main.ScreenPointToRay(Input.mousePosition); //2.hit RaycastHit h1; //3.if hit or not if(Physics.Raycast(r1,out h1)==true) { this.gameObject.GetComponent().SetDestination(h1.point); } } } }