2nd controller works in PIE but not in shipping build

Recently I have tried to build shipping version of game and I am having issue with 2nd controller when I build game. If I play game from editor (PIE) it works fine.

I have created:

  • one actor that manages some things around map (lets call it ManagerActor). ManagerActor is set to automatically receives input from first player (player index 0; keyboard and gamepad 1)
  • Player2Controller that handles input actions defined in project; Also onBeginPlay controller finds ManagerActor and stores in variable; when receives input it makes appropriate call to ManagerActor
  • GameMode that will create player by calling CreatePlayer with ControllerID: -1 (auto assign); I have also set Player2Controller as default

Now problem is that Player2Controller is not receiving any input when I build game ready for shipping.
If I run game PIE it works without issues (that is only way it works).
If I run game also from editor, but in separate window then it also doesn’t work.

I have gone through many online tutorials that I have found for adding 2nd controller support, but I still have same issue.
Some things I have tried:

  • creating Player2Pawn; also tried with assiging to Player2Pawn custom controller: Player2Controler
  • creating Actor which will autoreceive input for player with index 1 (I have tried other indexes as well)
  • GameMode to spawn Player2Pawn and make Player2Controller to posses it
    None of that fixed issue.

Everything is done in blueprints.

I have 2 gamepads (DS4 emulated with DS4Windows), both working without issues in other games.

EDIT: What I want to achieve is to have:

  • Player 1 to use keyboard and first gamepad
  • Player 2 to use second gamepad ← this doesn’t work

Just to make sure that I understand your problem correctly. You have two pawns, each controlled by a different playercontroller. You want that Player 1 uses the keyboard and Player 2 uses the gamepad.

Are you using splitscreen? If so you just need to check this bool.

Thanks for advice, but my game is shared screen.
I do have 2 players, but I want Player 1 to use keyboard and first gamepad, Player 2 should use second gamepad. My issue is that only first gamepad works, while second doesn’t produce any input.

If I do as you shown in answer, then Player 2 receives input from first gamepad, but then Player 1 is forced to use keyboard only.

Hmm, sorry it doesn’t work for you.
As far as I know, there is no way to do this without C++.
(Maybe there is a Plugin somewhere? Don’t know though)

Hope you succeed!

Ok, I will check that.
Thanks :slight_smile:

Ok, I have managed to solve it.

In my situation there were 2 issues:

  1. “Project settings > Input > Default Viewport Mouse Capture Mode” MUST be set to “Capture Permanently” (mine was “No Capture”)

  2. It seems that there is bug in UE, I had to do mouse click first in order to use 2nd controller (it simply doesn’t trigger inputs until left mouse click is performed).

For second issue workaround is to simulate left click calling SetFocusToGameViewport() in blueprint.
In my code (GameMode blueprint) I had to do like this:

  • Create 2nd player

  • Have small delay (0.1)

  • SetFocusToGameViewport()

I have found solution here: Can't control player 2 unless I click in the viewport - Programming & Scripting - Unreal Engine Forums

My guess is that issues are actually bugs in UE, since it only affects all controllers other than first one (keyboard and first gamepad).