well i already can spawn 2 characters in my map but i’ve been searching for hours a way to set it up the players controls on my local multiplayer game with the same input mapping.
Somebody can help me?
this is the code that i found for spawming
UWorld* currentWorld = GetWorld();
UGameInstance* gameInstance = currentWorld->GetGameInstance();
UGameViewportClient* gameViewport = currentWorld->GetGameViewport();
for (int32 i = 1; i <= iMaxPlayerCount; i++)
ULocalPlayer* localPlayer = gameInstance->CreateLocalPlayer(i, error, true);
I’m not personally sure if there is a better way to go about this with local multiplayer but one limitation I believe is in place is that you’re only allowed the use of one player controller in that case. Thinking within that limitation, you should be able to set up the input on both characters via the player controller rather than inside of the characters themselves, if you’re not already. By doing this, you could have any keybindings you have set up for the keyboard be executed through the player controller and have them affect player 1 or 2, whichever is using the keyboard, and have the opposite set up for the gamepad.
If I’m wrong about that limitation I apologize but I’m not well versed in this particular topic.