5.1 local multiplayer not working

I am trying to get a local multiplayer working on 5.1 - enhanced input enabled by default - but unable to do so.
Steps to reproduce
(2 Xbox gamepads connected)

  1. Create a third person project - 5.1
  2. Check “Skip Assigning Gamepad to Player 1” in Project settings, Maps & Modes
  3. Add an additional player start - 2 in total
  4. On a custom GameMode invoke CreateLocalPlayer
  5. Play

Result: only 1 player is being controlled by the keyboard and controller 1, controller 2 not registering any input - even on the editor unable to use it to create input actions

Expected result: Each gamepad controls each character

Note: Same process works on 5.0.3 with and without Enhanced Input.

I am doing something wrong?
Thanks in advance

14 Likes

Looks like I have the same issue. Two gamepads connected, only one of them works, always with Player Controller 0. “Skip Assigning Gamepad to Player 1” doesn’t seem to have any effect.

2 Likes

Same here, Im working on a 4 local multiplayer. On 5.0.3 it works with 4 controllers.
Now on 5.1 the Keyboard is allways hooked with controller 0, no matter what options i check

2 Likes

Were you guys able to figure out the issue/how to make it work? Thanks!

1 Like

Hey, no luck from my side.
I had to continue using 5.0.3 for multiplayer
Cheers

2 Likes

I just encountered this same issue with the engine/editor not recognizing input from a second controller for local co-op and I’m wondering if anybody has found a workaround that works in 5.1

1 Like

Hey all, I just figured out a workaround to get local multiplayer working again in 5.1 (at least in blueprint form). You need to make sure to force the second player to have a controller id that it’s neither ‘-1’ or ‘0’ and make sure to setup a mapping context for its Enhanced input subsystem. You can follow the blueprint example given in the enhanced input tutorial: Enhanced Input in Unreal Engine | Unreal Engine 5.1 Documentation

The only changes you have to make to that example is to use the controller generated by ‘Create Local Player’ to get its ‘Enhanced Input Local Subsystem’ and then in ‘Add Mapping Context’, you have to setup a mapping context object that is different from the one you used for Player 1. This second mapping context can be just a copy of your original one. But for whatever reason you can’t assign the same context object to both player controllers.

Can’t get this to work for me sadly :frowning:
I’m forcing the new local player controller to have an ID of 1 or higher but none work still.

1 Like

Did you set up an input mapping context for the second player? just changing the controller id is not enough to make it work

I tried all that, but no luck on my side.
I duplicated the default Input Mapping Context (IMC_Default), and assigned it to the second PlayerController created with “Create Local Player”, specifying controllerID = 1, but my controller still moves the player 1’s character.
FYI, I only have 1 gamepad connected. I am expecting the keyboard to move the player 1 and the gamepad to move the player 2

Ah, that won’t work for keyboard/gamepad combos unfortunately. This solution only works for 2 gamepads. Perhaps the way to make this work is to setup two different mapping contexts, one exclusively for keyboard and one for gamepad inputs, with no overlap between them

Hey guys, I may have found a solution to this problem.

A friend of mine contacted me today for this exact problem. Since I stumbled upon this post during my research, I thought I’d share and explain my solution to help others out. Please note that I am a software developer that has not actively worked in Unreal Engine for the past 2 years and was simply helping out a friend, so I am not up to date with everything new in ue5.

When hearing this problem I realised this might be some sort of order of execution problem where the players gets initialized faster than the controls can be set up. This is probably why adding a delay fixes the problem for some of you, but this is far from ideal. F.E. if the initilazation is pooled or threaded, slower systems might still not be ready after the delay and once again fail to initialize properly. This is why I started looking for ways to force the controls initilazation to happen after the player was set up. This is possible by making a custom GameMode and overriding the HandleStartingNewPlayer event to force Unreal to first initialize the player and then do the controls. An example in the image below (Note that the InitialiseControls event is a custom event on the player BP where my friend manages all his input related stuff):

Boom, that’s it. Everything input related works for my friend’s project and he can play with as many keyboards/controllers he likes (max 4 ofc due to local multiplayer). This approach also does not rely on time related code, making it more reliable. Hope this helps somebody out :slight_smile:

2 Likes

Hopefully this tutorial I put together will help you guys for 5.1

6 Likes

For those wanting a tutorial for a C++ implementation, I found these videos useful:

Also, if you already know the concepts, you can also create a Third Person C++ template project and see how they implement it there.

1 Like

Hi" How do I get the Parent: Handle

Starting New Player node? I can’t seem to figure out how to get it, please and thank you!

Hey there thanks for hopping into discord and I’m glad you got your issue resolved :sunglasses: happy developing :raised_hands:t3:

Hey there, is there a way to do this without the enhanced input? Because while this works in engine, this approach doesnot work when you make a build unfortunately :frowning: Then you will go back to using keyboard and controller.

1 Like

I’ve been running into these issues too. Trying to get all the information together in one place…

There’s a bug report that was created on Jan 4, 2023:

However, it was marked “Duplicate.” I’m not able to find the bug it’s a duplicate of, though - so I wonder if this fell through the cracks.

The bug does say “Target Fix” is Unreal Engine 5.2. Haven’t tried 5.2 out yet - so I’m not sure if it’s fixed there myself.

I do see there’s a bullet point in the Unreal Engine 5.2 release notes:

Fixed an issue where enhanced input bindings for Actor Components would not register at the correct time causing them to be unbound

Uno1982’s video mentions a few problems:

  1. @ 19:00: he mentions the “Skip Assigning Gamepad to Player 1” doesn’t work anymore. (I currently don’t see a separate bug for this)
  2. @ 19:55: -1 for Create Local Player Controller doesn’t work anymore. (I currently don’t see a separate bug for this)
  3. @ 24:35: he mentions the time delay issue - where trying to assign the enhanced input local player subsystem in a PlayerController’s BeginPlay Event can fail nondeterministically.

The other threads I see with this issue are:

  1. Q&A Post - separating keyboard and first gamepad
  2. Q&A Post - Can’t Control Local 2nd Player
  3. Q&A Post - Problem with Enhanced Input and Split Screen

Suggested Workarounds

For the Enhanced Input not registering correctly:

  1. Uno1982 released the template he used in his video in the Unreal Marketplace for $6. When I’ve tested it out, it’s worked well for me. My only issue here is that I’m trying to have the game support both local play and online play, and would ideally have one flow for code that could work for both. (Since in this project the GameMode is responsible for setting up the PlayerController’s input, that won’t work for online play)
2 Likes

I can confirm that UE5.1+ using enhanced input system seems to not handle multiple gamepads if the adding of input mapping context is made in begin play. The solution seems to be to add the mapping context at handlestartingnewplayer.

A part of the problem here is that the template projects come with code that tries to add the mapping context in Begin Play which is not working in UE 5.2

A quick screenshot illustrating how to do this in playercontroller and GameMode in c++.


Skip assigning gamepad to player 1 still doesn’t work tho. No solution for that as of now as far as I can see.

3 Likes

For people of the future, right click the node and click add call to parent function, in order to get the Parent: Handle Starting New Player.
Reference to Himistyr’s blueprint solution