Best way to detect input device switch

Hi,

In my game I have to switch the UI apparence according to the input device (mouse/keyboard or gamepad). Is there an event or something that I can use in Unreal ?

Otherwise I have tried to override the InputAxis and InputKey in my player controller to check if the input device has changed but it doesn’t works because it’s not triggered if I click on a UI button (I think that the UI consume the event) and I don’t know if I can avoid that and get all input event in my player controller ?

It’s the same behaviour with the PlayerInput and it seems the same if I override the GameViewportClient too.

The only that I have found to get all inputs is to create a new input processor (implementation of IInputProcessor) and register it to my slate application.

So what’sthe better way to manage my case ?

Thanks for the help !

You can use FHardwareInputDeviceChanged OnInputHardwareDeviceChanged;


image

1 Like