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).