Press "E" to activate Object. Display Gui-texture or Text ??

I’m currently a high school student working on an animation/game development project, and me and my group partners are having trouble figuring out how to get what we had envisioned to work.

Our goal was to have the cursor to be hidden in our scene, and instead have a crosshair to be at the center of the screen. When the crosshair hovers over certain objects when the player moves the mouse around, we want the object’s texture to change a color so the player knows its “selectable”. Upon hover, a text would display in the bottom of the screen to tell the player they can press “E” to activate the object. Upon pressing “E” to activate the object, it would either display subtitles/text at the bottom center, or a guitexture/image onto the screen. (E.g. if you pressed E on a paper on a desk, an overlay of that paper would be plastered across the players screen so it can be read legibly vs seeing it from afar)

Our objects are made in Maya and imported into Unity. We are working in javascript.

We are clearly rookies, but any code or direction would be greatly appreciated. Our project is due this Wednesday afternoon, and this is the only thing left in our project that we haven’t completed.

I have made something similar.
You want to use Raycast and check if it hits an object.

if(Physics.Raycast (transform.position, transform.forward, hit, 5))

This is the basic check for Raycast.

Then you can for example use switch case to check what tag the object has. Then when proper key is pressed something happens.

In order to hide your cursor you type “Screen.showCursor = false”.
In order to know what you are looking at you’ll want to use raycast as those above me has already pointed out.
For the text or images to pop up you could look at the GUI and for the crosshair to change color you want to look after either a color change or a way to switch between different materials.

Here are a few links that might get you starting:



Change Color