Can't control player 2 unless I click in the viewport
I have a local splitscreen multipayer game. When there is more than one player at the start of the level, only player 1 receives input from the gamepad and keyboard; none of the other players will receive input. The only fix I have for this at the moment is to left click with the mouse; once I left click everything functions normally.
Anyone have an idea as to why players 2, 3, and 4 aren't getting input from their gamepad until I left click with my mouse?
asked Jan 19 '15 at 06:16 AM in Using UE4
Looks like the problem is that the game viewport is only setting keyboard focus when the window is focused (the keyboard == controller 1). So even after left-clicking, if you alt+tab away from your PIE viewport and alt+tab back to it, once again only controller 1 will be working. This is certainly something we'll have to check out further and fix in the future.
In the meantime, there's thankfully a much more preferable workaround to forcing a click. The blueprint library function from UWidgetBlueprintLibrary called SetFocusToGameViewport. Since it's provided by a blueprint library, it can be accessed by any blueprint. If you're using C++, it's equivalent to calling
The only caveat here is that the game viewport needs to have been registered already, which hasn't happened when the level blueprint's BeginPlay event fires (that's also something we'll try to fix). So, the quick and dirty way to fix this is to register a one second timer that triggers a call to SetFocusToGameViewport. Of course, if you have a better spot to put it after BeginPlay fires, by all means :).
answered Jan 28 '15 at 09:51 PM
Dan Hertzka STAFF
Follow this question
Once you sign in you will be able to subscribe for any updates here