private void Update() { var ray = Camera.main.ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray.origin, ray.direction, out m_HitInfo)) { Debug.Log("true"); if (Input.GetMouseButtonDown(0)) { //m_Agent.Stop(); _lineRenderer.gameObject.SetActive(true); if (!IsCalulatePath) { Vect3.Clear(); _lineRenderer.positionCount = 0; path.ClearCorners(); StartPoint = m_HitInfo.point; } else { EndPoint = m_HitInfo.point; CalculatePath(StartPoint, EndPoint); } IsCalulatePath = !IsCalulatePath; } } }