// Update is called once per frame void Update() { RaycastHit hit; if (Physics.Raycast(playerEyes.transform.position, playerEyes.transform.forward, out hit, InteracionDistance, OnlyMaskToInteract)) { InteractionInterface II = hit.transform.gameObject.GetComponent <InteractionInterface>(); if (InteractionText && II != null && II.getIcon() != null) { InteractionText.SetActive(true); Icon.sprite = II.getIcon(); } if (actionPerformed) { hit.transform.gameObject.GetComponent <InteractionInterface>().ActionPerformed(); } } else { InteractionText.SetActive(false); } actionPerformed = false; }