I’m trying to tell the user which key to press to complete an action, though I would like it to be accurate to the keybindings.
How would I go about getting a list of keys bound to an action map in c++ (or blueprint if possible), and is there an existing function to get a friendly name for that key?
// Maybe something like this:
TArray<FName> GetKeysBoundToAction(FName actionName)
You can get a list of the keys mapped to an action by calling GetKeysForAction on the PlayerInput.
This gives you a list of FInputActionKeyMapping which contains an FKey. FKey has a function GetDisplayName that will give you the localized friendly name of the key. If the mapping has a modifier there isn’t currently anything to nicely make the Ctrl-A style display, I’ll make a note of looking at adding something like that.
Edit: Also, to answer another part of your question. This is not currently exposed to Blueprints. I will also make a note to think about the right way to do so.
For anyone reading this in the future, here is how you do the above answer in Blueprints. I did this in a Widget on 4.24.3. Just note that you may want to do something to handle the array of keys you get back. I am in prototype phase so this isn’t a major concern of mine.