Multiple inputs bound to an action

I have a system where something occurs once the user presses any of 0-9. (This can be changed so I don’t want to be hard-coding 0-9.) To avoid doing BindAction to all EInputEvents for all of those inputs, I decided that I could just stick them all under one action mapping.

The problem occurs here: How do I know which key I pressed in the delegate function? It seems that the only way to check this is by using playerController->WasInputKeyJustPressed(someKey), but I can’t pass in an actual value for ‘someKey’ because it could be 0-9 and A-G or whatever.

Then I thought that I could maybe use axis mappings instead, but then I won’t be able to tell whether the key has been held down, released, etc.

What is the best way to go about this?

Example use case:

There are 12 boxes in the scene, indexed 0 to 11. The user can press combinations of any of 0-9 to open each box at its index, ex. press 2 → opens box at index 2. However, if the user say holds 2 instead of just tapping it, boxes[2] will float in the air, then drop back to the ground when the key is released.

So I do need to know all of: what key was pressed (ideally combinations would work too), and how is was pressed (tapped/held/released/double-tapped).

do 0 - 9 all do the same thing, or do they do different things? if they all do the same thing, than you will never need to know which of those keys were pressed. if they all do different things, they should each have their own unique keybinding.

could you describe a use case, that explains a user pressing 2 of those keys, then rebinding the functionality, then pressing those 2 keys again, and the results you want from each keypress?

im not sure exactly what you are trying to do, but it sounds like you need another layer of indirection.

I’ve updated the question with an example use case.

It doesn’t seem like there are official functions to check key states within axis bindings, so I just did it manually. Using the example box scene: made an array of 12 elements storing key state enums. If arr[i] was None, now arr[i] = Tap. If arr[i] was Tap, now it’s Hold, and so on.