void Update() { RaycastHit hit; crosshair.color = Color.white; if (Physics.Raycast(transform.position, transform.forward, out hit, rayLenght)) { if (hit.collider.CompareTag(interactableTag)) { crosshair.color = Color.red; if (Input.GetKeyDown(KeyCode.E)) { if (door = hit.collider.gameObject.GetComponent <DoorScript>()) { door.PlayAnimation(); } if (coll = hit.collider.gameObject.GetComponent <CollectibleScript>()) { Animator anim = pickTxt.gameObject.GetComponent <Animator>(); anim.Play("FadeIn"); coll.CollectItem(hit); CalculateScore(); } } } } }