- Home /
How to display the key codes of certain buttons?
Hello.
I currently have the standard FPS Controller and I'm using the default Input Manager in my game.
My FPS Controller's camera has a script attached to it that has a raycast specifically for detecting interactable objects. If the raycast hits an object that you can interact with it, it writes a text saying something like "click here to interact".
What I want, however, is to display the key that is assigned for interacting. Right now I have a custom button set in the Input manager that is named "Interact" and its default key is F. I want the script to display the actual key, even if it would be remapped to something else, like E or R or whatever.
I have tried googling this, but the only closest thing I seem to find is detecting which key was pressed, which is not what I want. I only want to display a key that the person needs to press in order to activate the object.
Is that somehow possible without writing a custom Input Manager?
Thank you.
Your answer
![](https://koobas.hobune.stream/wayback/20220612102715im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Is there a way to combine the Update and OnGUI functions? 1 Answer
assign keyboard buttons 1 Answer
Delay when Animation used 2 Answers
How to switch JUMP BUTTON(SPACE KEY) into VIRTUAL BUTTON ON THE SCREEN? 2 Answers
[4.6 UI] See through Buttons 1 Answer