private void MakeUnitGo(Unit unit) { UnitGo unitGo = GameObject.Instantiate( unitPrefab, Vector3.zero, Quaternion.identity, unitParent ).GetComponent <UnitGo>(); unitGo.unit = unit; }
private void HandleClick() { ray = Camera.main.ScreenPointToRay(Input.mousePosition); UnitGo unitGo = null; if (Physics.Raycast(ray, out hit) && hit.transform != null && (bool)(unitGo = hit.transform.GetComponent <UnitGo>()) ) { gameManager.Select(unitGo.unit); } else { gameManager.Select(null); } }