public void Update() { if (selectedUnits.Count() > 0) { Vector3 mouse = Input.mousePosition; Ray castPoint = Camera.main.ScreenPointToRay(mouse); RaycastHit hit; bool result = Physics.Raycast(castPoint, out hit, Mathf.Infinity, layers); if (result) { HandleHover(hit); if (Input.GetMouseButtonDown(1)) { HandleMouseClick(hit); } } } }