void Update() { if (Input.GetButton("Mark")) { RaycastHit hitInfo; if (Physics.Raycast(mainCam.ScreenPointToRay(Input.mousePosition), out hitInfo, 10)) { string tagToMatch; if (data.GetCurrentTurn() == false) { tagToMatch = "Red Pen"; } else { tagToMatch = "Blue Pen"; } if (hitInfo.transform.gameObject.CompareTag(tagToMatch)) { if (arrow) { Destroy(arrow); } else { fireButton.enabled = true; } arrow = Instantiate(arrowPrefab, hitInfo.point, Quaternion.LookRotation(-hitInfo.normal)); normal = -hitInfo.normal; } } } }