- Home /
The question is answered, right answer was accepted
How to get the key from the button name
Hello.
I can't seem to find any answer for this one. In many games once the player configures the input buttons the changes are reflected in the text prompts on the screen. For example if the player sets "Fire" as Mouse Button 1 or F (for example), on the screen the player will see : 'Use Mouse Button 1 to fire' or 'Use F to fire'.
I would like to this too (JS) :
var prompt = "Use " + keySetAsFire + " to fire";
GUIText.text = prompt;
My problem is finding the "keySetAsFire" variable. Is this possible in Unity?
Answer by Eric5h5 · Sep 21, 2014 at 09:14 PM
Unfortunately there is no API for that. You'd need to create your own input manager or get one from the asset store.
Follow this Question
Related Questions
displaying playerprefs 1 Answer
NGUI KeyBinding Reversal? 0 Answers
Why right alt (alt gr) acts like left ctrl?! 1 Answer
Assign a hotkey to a GUI button? 3 Answers