UE5 only detects one gamepad (xinput slot #1)

Hey guys!
I switched from Unity to Unreal and wanted to create a local multiplayer game. I connected four gamepads to my PC (2x JoyCons & 2x PS4 Controller).

My Problem:
It only detects and uses the first connected gamepad (xinput slot #1).
And this even while mapping the Input Context


When I click on the little gamepad icon and press buttons on the gamepads, it only detects the presses on the first connected (JoyCon or PS4 doesn’t matter)

What I’ve tried:

  • I emulated all gamepads as xbox360 controllers via “WoJ XInput”, “reWASD”, “DS4Windows” and “BetterJoy” and nothing worked. Same behaviour with every emulation application.
  • I googled a whole bunch and found nothing that helped with this exact problem
  • I used the RawInput Plugin with no luck
  • Changed the gamepad order with no luck (only the first one works)
  • When I run “XinputChecker” it detects every gamepad and every button / axis works with Windows itself.

Did I do something wrong?
Do I need to add a new hardware device? But how?
I am new to Unreal.

Thanks in advance!

  • Christian

Have you added local players?

Not yet, is it necessary to do this for the input of multiple gamepads to work?
I wanted the gamepads to work before even thinking about playing or designing anything. I just tried the gamepads in the mapping context for assigning the mappings (screenshot from initial post).

Do multiple gamepads not work in the input mapping context?
Do I have to use “Create Local Player” Nodes and “Add Mapping Context” for it to work?
If that is true: How do I assign the mappings and then the different Gamepads to the players?

Thank you!

Okay, after two frustrating days debugging this gamepad hell, I found the solution.

The Solution broken down:

  1. You only map the keys in the “Input Mapping Context” (screenshot initial post) from the first gamepad (you don’t need to map the others)
  2. To get it working ingame:
    2.1. Use “Create Local Player” in Gamemode Blueprint (screenshot 1 below)
    2.2. Add a “Delay” before adding the mapping context in the PlayerController. (screenshot 2 below)

Adding the delay seems to be crucial part.
I don’t understand this behaviour and it is very frustrating in my opinion.

Screenshot 1

Screenshot 2

the delay has to be used because you’re either A) not doing your order of operations properly or B) there was a bug on 5.?3? that caused this when playing in editor but not on a packaged product. adding a delay is the worst workaround. Instead you need to do a logic loop using Set Timer By Function that checks if the subsystem has initialized yet. Also this should be done anyways in case it fails for any reason. It also wouldn’t be a bad idea to add a loop counter that stops it in case it goes indefinitely and notifies the player that the input system has failed and the game should be restarted.

But again this is a workaround and a fail safe. you need to make sure your order of operations are executing. The easiest way I’ve found to do this is, in a GameMode class use the “Event HandleStartingNewPlayer” event, filter it with an If statement that checks to make sure its only when player 0 (the first player) is being processed, and then call your function that adds local players. Using HandleStartingNewPlayer as a starting point for adding local players ensures all the necessary subsystems are initialized. Player0 is created by default by the engine so the if statement is to make sure you’re not creating a loop every time u add a new player it adds a new player that adds a new player and so on.

also it would have been nice if u gave me credit for the solution because my simple reply was exactly the answer you needed to your original question.

But to answer your other questions
yes you have to add local players then add mapping contexts. the game automatically assigns gamepads to the player controller. each local player gets their own instance of the player controller set for the level.
Your logic for CE_CreatePlayers is kind of flawed. Theres no sense in possessing a pawn that is already possesed (get controlled pawn gets the pawn that is currently possessed, but also is meant for AI Controllers not Player Controllers iirc). If your game mode is set to have default Pawns it will automatically spawn and posses pawns when a player controller is created.

1 Like

Thanks for going into detail! This helped a lot with understanding the concepts and workflows better!

I will check my blueprints with your suggestions and try to improve them.