New Input System: Event on input type changed (between mouse, keyboard and controller)

I’m trying out the new input system - looks great!

In my game, I want the player to be able to switch between using mouse or keyboard or controller seamlessly. In order for this to work I need an event whenever the user starts using a different input device. So if the user is using the keyboard and touches the mouse, I want an event triggered, that tells me, that the input has changed to mouse-input.

Is there any easy or built-in way to do this? Or do I have to make a script that monitors every type of input in every frame and sent out those events?

I was looking to do the same thing and I think I figured it out.

In your action map, add an action for ‘KeyboardUsed’ or something similar. Then you can add a binding for ‘any key’ on the keyboard. If you press ‘listen’ and press a key then the key you pressed and the ‘any key’ option should show up as options.

For the controller it is slightly more tedious. There is no ‘any button’ for the controller, so you can add an action for ‘ControllerUsed’ with all of the controller inputs bound to it.

With the mouse you will need to change the action’s Control Type to Any, and then bind all the mouse buttons and ‘delta’ to the ‘MouseUsed’ action.

Then, in code you can add functions to be called when any of ‘KeyboardUsed’, ‘ControllerUsed’, or ‘MouseUsed’ actions occur just like you would with any input action.