When RaycastHit show text on screen. How can I do that?

So basically I have this two scripts, does anyone know what code should I add to achieve something like when I have the mouse pointing on the gameobject a text pops up for example (press “e” to open)

For the love of god, just paste your code, dont screenshot it :smile:

You already have the raycast and object detection handled.

Create an UI Text object with the text you want and put it in the middle of your screen. Then disable it in editor (you dont want it to be enabled by default)

Do a raycast every frame and check if your player is looking at any object. If your raycast hits an object - enable the text object and if the raycast doesnt hit anything, disable the text object.