How to show Input Key in Text / String

I want to show “Press E to interact” as a text, but instead of the “E” I want to display the actual mapped button for that specific input. How do I create a text or string like that?

bump
Is there no way to get what key an input is assigned to? Not exposed to Blueprint?

Hi

Are you allowing players to map there own Keys?

Ok,

Sorry but you question was just how to display it.

So you have already worked out how to Set up the Key Maping so it works, so this should be sort of simple then.

Can you show how you have set this up so we can have a look and give some suggestions.

Ok, have you played with appending stuff?

Sure, that’s the point of assigning input keys, isn’t it?

Currently I’m just using a string that says “Hold E to pick up item”. What I want to do is somehow take the correct key of that input and then build a string around it. Something like
“Hold” {inputkey} “to pick up item”

Yes, I know. Now tell me how you define that variable so it is the input key that is assigned to it.

Yes, text shows up when near an interactable .

It seems that setting different keys for input is also not supported in Blueprint…

OP is not asking how to append strings.

Rather how to store “typed” text in a variable.

This will make a String from any variables.

It goes on and on my friend.

You are having this for when for you go near a BP such as, Pickup Item, Open Door, Talk to shopkeep?

Could you store some of that data in the BP it self, and activate on overlap.

So when the character chooses what their bindings are, you set a Var for each in an array or just as. This is now “E” Var.

When the BP get spawned, and gets the “Key” Stoke VAR it needs, such as “Q”.

On begin overlap, you can access that VAR and input that in to your string.

EDIT: Thought I should make this a bit clearer.

There’s an override function called [OnKeyDown in UMG Blueprint.

1) Create a Widget Blueprint.


2) Open it and switch to the Graph view, and in the Functions section of the My Blueprint Panel, Click to open the Override dropdown.


3) Select “OnKeyDown”


4) There’s a bunch of things you can do but here’s a quick example to print the keypress to screen.


5) Add the following in the Level Blueprint, CharacterBP or somewhere to add the Widget to the viewport. Select the name of your Widget in the Class selector of the Create Widget node.


6) I added a button as something to click on to make sure the UI has focus.


7) When playing, hit Shift+F1 to release the mouse, click the button for focus and type away!


But if that doesn’t work out for you, take a look at [Rama’s UMG Rebindable Key System][9], It’s free and appears to do everything you need! (Original Project is for 4.5, but a vid was posted later in the thread showing how to use in 4.7+)

Editing an answer might not trigger a re-notification email, so I’m bumping with this comment in hopes that it prevents the Asker from missing the updated info above. :slight_smile:

This is interesting, but not an answer to my initial question.
Maybe this is useful if you want to rebind keys, but it seems this is not supported in Blueprint right now.

The Rama Plugin doesn’t work for some reason, it crashes my application.

I think this is a good place for a feature request.
We need the following nodes:

Retrieve the assigned action/axis mapping keys.

Reassign action/axis mappings at runtime.

I needed to create this key consumer widget without any component in canvas.
To do that, you need to:

Figure 1) Set Widget’s inherited variable bIsFocusable to true.

Figure 2) Call SetKeyboardFocus on the widget from PlayerController, or anything that may deal with input.