How would I retrieve the last used device, as in the last device for which input was processed? This is for the typical Mouse & keyboard + plugged in gamepad scenario.
Code (CSharp): Mouse.current Keyboard.current Gamepad.current To get rid of noisy gamepads (such as PS4) push themselves to the front, flip on "Filter Noise on Current" in the input system settings (found under project settings).
Thanks for the reply, but I'm not sure I follow. When I have all three devices connected but I want to show control icons depending on which device is currently used, how would I go about that? For example: User clicks mouse button -> show kb&m icons. User moves gamepad stick -> show gamepad icons.
For that, the recommended way is to use PlayerInput. See here. Add one control scheme for keyboard&mouse and one for gamepad. Listen to InputUser.onChange to get notified when the control scheme switches. PlayerInput.currentControlScheme is the active control scheme.
I am currently in the same situation, I want to let the user switch from keyboard / mouse to controller and back (especially when typing messages in multiplayer chat) I do not want to use the PlayerInput component, is there any other solution to this? Checking for current active controlscheme doesn’t solve this because my keyboard+mouse AND controller scheme are both active at the same time to allow for this hot swap (having all devices connected, but not necessarily used, and never both used at the same time)