5.1 local multiplayer not working

Perhaps, I haven’t renamed some of the code properly. I’m not sure as I tried this soon after you posted your code and I can’t remember what was wrong (this was my first time making changes in C++ as well so there could be many things I might have done wrong). I think I was getting errors and could not compile the new code. Thank you though, I will post here once I get back to this.
I still have many other things to do in the meantime and I keep having weird bugs since I moved to 5.3 so there is no shortage of things to fix for me!

I finally understand what you mean with bug reports :slight_smile: I’ll see what happens once I start submitting mine! It kinda sucks that the tickets are actually filtered…

I’m surprised how responsive you both are. That’s awesome

Cheers

2 Likes

Just tried it on 5.3, and it worked!
Now my keyboard send input to controller 0, and gamepad to controller 1
Thank you!

2 Likes

It works for me (5.3) too! Thank you very much.

Just FYI to anyone reading this, you also need to include “ApplicationCore”, “Slate”, “SlateCore”, “EngineSettings”, “EnhancedInput” dependency to your Build.cs file in order for it to be linked.

2 Likes

Can you share your solution with detail? Thanks

I’m not seeing this behavior? Skip controller with gamepad project settings still don’t appear to be working in 5.3 binary (launcher)

Edit: Nevermind I see now you were talking about the custom viewport code class… the forum has a strange way so showing replies.

For anyone interested in a well documented mapping system I did find this when searching for any PRs related to the Skip Player 1 bool
Add functionality to map devices to player controllers by KristofMorva · Pull Request #5209 · EpicGames/UnrealEngine (github.com)

You’ll need to create a new C++ class inheriting from GameViewportClient, copy the code I posted into the header/cpp file (renaming it to match your class name etc), and set that as your viewport class in project settings.

If you’re not familiar with C++ you’ll probably want to watch a few tutorials on that, and those instructions will make sense.

1 Like

Hey, anybody found a solution for this ? i’ve been trying for 3 days without any success…

Also i don’t know C++, have no idea how to even start to learn this.

I’ve tried this and hooked up some print nodes to debug. The print nodes come out just fine, but I still can’t get it to work. Think you could make a detailed explanation?

Hi man .Can you share your project with me? I test the code .it doesn’t work . I change the game view . But still cann’t control player2

Greetings!
I found a way to make the local multiplayer work. I am on 5.3 and the problem persisted.
I followed this guide but still it would not work, the 2nd controller does not respond:

Now, what I did was the following:
In the thirdpersoncharacter blueprint, after the Event beginPlay
node, the next node I put is a Delay node of 0,1 second. And it worked.

I am not entirely sure why but I think what is happening is that the enhanced input local player subsytem is activating before the other players are created, and thus they receive no mapping context at the time of their creation. With a delay of 0,1 (or any other delay), I think the other players are created first and then given a mapping context.

1 Like

Hey thanks! This worked perfectly for me.

Confirming that this bug is still present in UE 5.3. Any news of a bug report or fix in the works for this? It’s a pretty frustrating issue and seems like it would be easy to fix.

This now appears to be fixed in UE5.4 Preview

2 Likes

Nice to see that it’s finally fixed. Shame it took them over a year and they never acknowledged any of the bug reports, but that seems pretty standard for Epic these days.

Can someone help me? I’ve been trying to find a solution by reading this forum, trying out the methods presented, watching videos, and getting help from Discord, but I’m still stuck.

I created a Local Player with the Controller ID being 1.

I added Mapping Context with the Local Player as the Target.

I possessed my character using the created Player Controller.

The inputs don’t work when PlayerController_0 is being used either.

(The blueprint is in my GameMode)

Problem: My inputs don’t work and I can’t move my character. Any help would be appreciated!



Screenshot 2024-04-01 125701

Never mind, I was able to figure it out!

It took me 6 days for something so simple!! I overcomplicated the whole thing because for my game I didn’t even need to use multiplayer and create a local player. I just used the Player Controller with index 0, two different Mapping Contexts, and Inputs, then I called them and checked my Player Variables if P1 = 1 or P2 = 2 to execute the movement. I’m so relieved right now.

Hey guys. So it seems the solution for the “Skip Assigning Gamepad to Player 1” will be fixed in 5.4.

If you are in 5.3 and don’t want to mess with the C++ code or you have a BP only project, here you have a Plugin that I made that implements the exactly same fix that will be in 5.4.

It will only work on Windows and UE 5.3 but you can compile it for your platform yourself.

Steps:

  1. Download the custom Plugin GameViewportLocalMultiplayer.zip - Google Drive
  2. Unzip and add it to your project in the Plugins folder.
  3. Open the Project (Enable the plugin GameViewportLocalMultiplayer) and go to Project Settings - Game Viewport Client Class and replace the current vlaue with the CommonGameViewportMultiplayer.
  4. Restart and Done

BTW: This will work with Common UI Projects so this Plugin inherits from Common UI Game Viewport. Just in case

Let’s wait for the final 5.4 fix but at least you have this for the moment :slight_smile:

2 Likes