Strange input routing issue with a new Input Device

Also posted on AnswerHUB here: Odd Input Issue with a new InputDevice - UE4 AnswerHub

So I’m building a fun project that supports massive local player (8+ local players) and to do this I need better control over my input. So I wrote a new InputDevice that interfaces with SDL2 to provide both more diverse gamepad support as well as supporting more than 4 players. It’s working fine.

However, when a button/axis change is first detected it makes it to slate but not to my UGameViewportClient child. The log shows:

[2020.01.12-17.59.47:810][829]LogSlate: New Slate User Created. User Index 10, Is Virtual User: 0
[2020.01.12-17.59.47:810][829]LogSlate: Slate User Registered. User Index 10, Is Virtual User: 0

And the widget reflector shows that the current focused widget is the SViewport. If I click on the scene or open the console, input will now properly flow to my GVC. However any new controllers have the same effect. No input is registered until I press a button, then click on the viewport. I used the RawInputHandler as my base for how to build an input handler and nothing jumps out at me as out of place. But since I’ve never written an InputDevice before I might be missing something. I’m going to start tracing the input/focus system of slate but we all know how much fun that is.

If anyone has an idea what might be happening please let me know. Also, if you want to help test out the plugin, PM me.

FWIW: This happens because when slate sees the new ControllerID it creates a virtual user. But it doesn’t setup any focus for that user. So until a focus changing event occurs, input is ignored. The solution was to create the virtual user when I detected the device attaching and force it’s user focus to the GameViewport.