void Update() { RaycastHit hit; Vector3 fwd = transform.TransformDirection(Vector3.forward); if (Physics.Raycast(transform.position, fwd, out hit, rayLength, newLayerMask.value)) { if (hit.collider.CompareTag("Consumable")) { CrosshairActive(); raycastedObj = hit.collider.gameObject; ItemProperties properties = raycastedObj.GetComponent <ItemProperties>(); itemNameText.text = properties.itemName; if (Input.GetMouseButtonDown(0)) { properties.Interaction(playerVitals); } } } else { CrosshairNormal(); itemNameText.text = null; } }