How to show Input Key in Text / String

Are there any updates on this?

That’s awesome! Thank you very much, you’ve probably saved me a lot of figuring this out! :slight_smile:

Yes. In fact, since 4.17 this is a supported feature in the Unreal Engine.

To access any action key name, add the following nodes:

“Get Input Settings” > “Get Action Mapping by Name” > enter the name of the action you want > “Break Action Key Mapping Struct” > from the KEY > Get Display Name

For axis mappings, just replace action with axis and do the same steps.

If player has multiple key bindings for the same action, you can add them one after another and place an “or” between the keys or just take the first you get. You can also filter out Gamepad buttons and display them seperately if you add a branch with a “is gamepad key” from the key in the struct.

1 Like

Not sure if your method would actually work since the “key” is part of your event. I’ve answered my own question (since it’s been years when I first posted this) just above your post. Maybe my answer can give you satisfying results as well.

I had the same issue and wanted to display the key players had selected inside my strings. So If you go to your Project Settings → Input. You can Edit your keys for your game. In my case I wanted to have a “Use” key and wanted that key to appear every i wanted to Use something such as a door or to pickup an item.

So once you set your Inputs go back to whatever blueprint your wanting the string on and get the Node for your Input. In my case it’s “Use” So I type “Use” and “Input Action Use” appears. Next drag a wire off of the “Key” pin and type get “Key Display Name” then you can use that in your strings. I use my HUD class to display Text on my players HUD for hints. So mine looks like this:

Yea I just started getting into UE4 so I didn’t think about it. Your right. My way won’t initially give any value. It just gives you “NONE” on your Strings until you press the “Use” key you assigned. :frowning: Oh well.

Is this achievable in pure text like “Press { magic code text here } to jump” to display a visualization of a button or Key?
For purpose of just using C++.

I know this is an old post but I had the same issue and ended up finding a resolution, since this was one of the places I looked for an answer and didn’t find one I thought I would share what I found here in case it helps anyone else.

From Get Input Settings, you’ll need to enter the Action Name of whatever the Action Mapping is called you are wanting to get the keybind(s) from, it will output the mappings into an array, so the first mapping should be the first in the array, you’ll break that to get the key display name.

Hope this helps.

but how do you get the Keyboard KEY itself ? I want to display keys on the hud, I dont want the display name

1 Like

Any luck anyone?

That does return the key (or things like “space”)

2 Likes