void Update() { Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition); RaycastHit hit; if (Physics.Raycast(ray, out hit, 100f, LayerMask)) { GameObject hitObject = hit.transform.gameObject; SelectTarget(hitObject); TargetIndicator.SetActive(true); } else { ClearSelection(); } if (Input.GetButtonDown("Fast Forward")) { IsRegrettingDecision = true; ClearSelection(); TargetIndicator.SetActive(false); } if (SelectedObject != null && Input.GetButtonDown("Action Command")) { Debug.Log("Selected target"); TargetIndicator.SetActive(false); Renderer[] renderers = SelectedObject.GetComponentsInChildren <Renderer>(); foreach (Renderer r in renderers) { Material m = r.material; m.color = Color.white; r.material = m; } if (IsSingleTargetting) { TargetSelector.ChooseTarget(SelectedObject); } IsTargetSelected = true; } }