Simple interact script?

Hi
I’m having a lot of trouble. I’ve been trying to make an interact script for my gifted class. I need it so if your close to a certain object and click mouse0, then a GUI Texture will appear. I also want it the Texture to go away when the x key is pressed. As an example, If you get close to a note and left click by it the. You’ll see the note, and put the note down when you hit x.

First decide if you want to use tags or layers. In some function somewhere, you’ll need to raycast or linecraft from the camera and check for the tag or layer of the object to pick up. If the layer or tag matches, change the guitexture from null to some texture that you can store in a monobehavior on the object being interacted with. In your OnGUI function, draw that texture when ever it is null. Somewhere else where you’re gathering input, have the guitexture be set to null when you hit x. That will have the effect of closing a note when you have one open.