How to get icon for input action

Hello,

I want to show an icon for a input action. Your standard “‘E’ to Interact” type of thing.

There doesn’t seem to be anything built in for this. So my thought was to use a DataTable, but I can’t figure out how to get the ‘real’ button that is mapped to an input action.

Any advice would be great, thanks!

1 Like

look into common UI plugin and the common action widget

You could create an empty actor and put in a collision box and On Component Begin Overlap cast to your character and create a widget through a function in your character.

You could also set a boolean to true on the begin overlap while casting to the character so that the input action can only be ran if inside the collision through the use of a branch with said boolean. You can set it back to false and remove the widget with the On Component End Overlap so they don’t see the widget or can’t run the interact function either.

Hey, thanks for the suggestion.

It seems to not have anything for actual Project Settings InputActions. Instead just UI specific input. Which this is nice, and I will for sure be using it, but it is also not what I am looking for. If I’m missing something please let me know!

Thanks for the suggestion, but what I am actually trying to do is to map and get an texture for a given input. Like if I have the “E” key mapped to the “Interact” input action. Then I could get a texture with a “E” on it. And if it is a controller it would instead get like a Xbox “X” button texture, etc.

Hope that clears up what I am wanting to do.

1 Like

this is what common UI solves (well one thing that it solves). What epics livestream about it, you’ll see. I also made a thread to gather resources on it, here : Common UI Notes - Programming & Scripting / UI - Unreal Engine Forums. There is links for further resources that can be tough to find.

If you say so. But I can’t find a way to map it to the Project Setting InputActions. Only the UI specific inputs that are setup in the CommonInputActionDataBase. Which is not what I am going for. Please let me know if there is a way that I am just missing.

if you watch the video it is explained why doing it that way is beneficial (cross platform compatability)

if you want to make it match your input actions/axis by name, you’ll just have to manually enter the same names in the data table. Or you could otherwise roll your own system in which you associate an input action with a name, and pass the name to widgets, but that would be a butt-load of work to get a less robust system that you’d get with commonUI.

1 Like

I appreciate you taking the time to help me with this. However I feel like one of us is misunderstanding the other in some way.

I hope this image makes it clearer what I am struggling with.

ah i missed that you want runtime key rebinds.

I took a look and the Lyra project which uses commonUI has key rebinding. I dont know how they are doing it, but you could look in there and probably get some idea.

I know that it is possible to change data tables at runtime - I believe there is some blueprint plugins on marketplace but otherwise it requires some c++ from what I’ve read.

One other option - there is quite a few UI systems on the marketplace that have runtime key binding. This is accomplished in many different ways, but somewhere you end up with reference to a key and it’s associated with input action/axis. So that is all you need to select some images from.
I would call this the simplest solution because it means you can just grab an existing, blueprint only example, and all you got to do is find the function where rebinding happens and then find a way to get that key reference and store it somewhere your widget can access. The you can make your own image switcher which just gets that reference and switches the image based on what input action you want it to represent.

Do you solve your issue, I’m stuck in the same place :slight_smile:

This is working for me

Search sent me here looking for the same.
The CommonActionWidget failed for me for displaying the KeyboardsMouse data with Enhanced Input actions.

For the icon you can use
CommonUI->GetEnhancedInputActionButtonIcon()

If you are in C++

CommonUI::GetIconForEnhancedInputAction(GetInputSubsystem(), EnhancedInputAction);

Working in current project on 5.2 with player mappable keybindings and console/controller/pc support.

2 Likes

CommonUI feels very clunky to me especially when I want runtime Keybindings so I made a tutorial on doing it without commonUI https://youtu.be/IBlKyo0UXjM