Enhanced Input - Detect Gamepad vs Keyboard Input

Update:
I found a way to do the above, but it feels quite messy…

  1. I use the Query Keys Mapped to Action node for my IA_Interact.
  2. Then I loop through the return array and get the Display Name for each mapped key.
  3. Next, I use Find Substring on each, looking for the substring “Gamepad Face” and checking if the Return Value is greater than -1.
  4. If it is (greater than -1), I then Get Substring on it, starting at position 20 (to eliminate "Gamepad Face Button "), with a Length of 10 (just to catch everything), and set the result as my GamepadInteractKey variable.
  5. I also check for Key Display Names that return less than 0 for both the substrings Gamepad and Mouse to determine which keyboard key is mapped to IA_Interact, so that I can throw out that prompt correctly and dynamically, too.

It took me way too long to figure out that you need to do all this after a short delay (default of 0.2 works fine), or it won’t work on Begin Play.

Once that’s all done, I “just” needed to assign each face button glyph to its respective mapping… and since I offer multiple glyph sets (Xbox One/Series, Xbox 360, PS4, PS5, Switch Pro and “generic”, I had to do that for each possible set x4… messy af. :sweat_smile:


It does work very well, though.



3 Likes