PlayerInput Multi-Player Scheme Issue
Under Audit
Unity 2022.3.x - Unity 6.1.x
Published 9 days ago
When transitioning between scenes in local multiplayer, assigning PlayerInput control schemes and devices from existing GameObjects to newly instantiated ones may fail for three or more players, causing control issues.
When developing local multiplayer games with scene transitions, assigning PlayerInput control schemes and devices from persistent "lobby" GameObject instances to newly instantiated "game" character GameObject instances can lead to unexpected behavior. While this process may function correctly for two players, it often breaks when three or more players are involved. Symptoms include: persistent "lobby" GameObject instances that are not destroyed and remain controllable, only the first user's character being instantiated, and that single instantiated character being controlled by all connected gamepads/keyboards. A debug log intended to find all PlayerControllerScript instances correctly identifies all three, but a subsequent debug log within the assignment loop only prints once. This scenario commonly triggers an InvalidOperationException: Invalid user.
- Consider converting the “lobby”
GameObjectdirectly into the “game” character rather than destroying it and instantiating a new one. - Explicitly manage
PlayerInput.userassignments, ensuring each new character receives a distinct user associated with its input devices. - Verify
Input System Packagesettings to confirm the maximum number of players orInput Usersis configured to support the required player count.
Editor's Note:
Related Posts Haven't quite found a solution to your problem? We think these posts might help you.
Content inspired by a Unity discussion post.