I made an inventory system for my game but I want players to be able to do fast switching by pressing the buttons from 1 to 9. I defined an action input and put 9 keys in that action input. Basically, the same function will be called from those keys; however, I need to detect which key has been pressed, so that I can select an item from the inventory. How can I detect the key which has been pressed? Or can I get the index of the key? A solution in both blueprint or C++ is okay.
I’m thinking of defining 9 action inputs but it doesn’t look like the best way to do, and also I can’t block pressing multiple keys by doing that, I guess. “If statements” at the beginning of the functions may not be adequate?