Hovering over an Object script and it displays a label

I’m working on a Horror game called Downturn and I’ve coded a Flashlight script but now I wanna make a script is JS or C# that when I hover over an Object it’ll pop up a label in the middle of the screen saying… Press (E) to turn off Alarm. Something along that line and when he/she isn’t hovering anymore it’ll be removed.

Also, if it’s possible which it is in C# to add something like a toggle for example when hovering over the object it’ll show on screen “Press (E) to turn Alarm on” & when the alarm or whatever it is and you hover on the object again it’ll say “Press (E) to turn Alarm Off”

BUMP

without knowing a lot more about your scene/project it’ll be hard to provide much more than pointers…

there is the built in:

(ignore the reference to GUIElements, that’s old UI system…)

or failing that you can look at manually coding something with raycasts

(you wont be instantiating anything but calling a function on the object that was hit to bring up the UI you want for that you’ll need a raycast function which has a “out hit” parameter)

basic UI creation is covered in the learn section Learn game development w/ Unity | Courses & tutorials in game design, VR, AR, & Real-time 3D | Unity Learn

1 Like

Thank you I’ll look into this.