How can I get text in a canvas to display the name of a key that is chosen by the player in the input panel of the launcher?

Pretty simple question, basically, what I want is something on the HUD to tell the player what key to press to activate a certain ability.


weaponKey.GetComponent(UI.Text).text = /*Button from input panel*/;

Thanks for your help, guys. c:

Unfortunately, there is no official support for accessing the Input Manager from scripting, though it’s been frequently requested for a very long time. Based on the roadmap, it seems likely that Unity is waiting until they can completely overhaul the input system.

There is a hacky, unofficial way to access and manipulate the data manually in the editor, so it is possible to add some sort of scene or build postprocess hook to update public string fields of desired scripts to have the correct button names. However, this is pretty overkill, and would not work if the user changed the input settings in the launcher anyway.