Is there a way to call a function when any input is pressed, like any key or axis, etc?
I’m developing a PC game and I wanna to switch the “Press E key to do something” to “Press X button to do Something” if the player change to a gamepad during the game, and the way I am thinking is to check when some input was pressed, if this input just pressed is from gamepad, but do the inverse if he switch to a keyboard. But I don’t wanna to check this manually in Tick, this is the reason I wanna to know if there is a function to generic (any) input pressed.
Note: Preferably a C++ solution, but it can be in Blueprints also.
There isn’t any sort of “OnAnyInput” function, but one thing you could do is write a quick helper function that you call at the beginning of your inputs checking if it came from a gamepad, and if it did you can change any UI elements you want to. Or you can (As annoying as it is) make one input mapping that contains all inputs from a gamepad, and bind your function to that.
In UMG widgets u can make override “On Key Down/Up” for controllers and “Mouse Button Up/Down” for mouse, but it will be call only if that widget is on the screen.