UnityRef is currently in early development. Some features may be incomplete and/or not functioning.

UNITYREF

Your Pit Stop For Solving ANYTHING in Unity

architecture

PlayerInput Multi-Player Scheme Issue

Under Audit

multiplayerinput system

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.

Issue

 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.

Experimental Fixes
  • Consider converting the “lobby” GameObject directly into the “game” character rather than destroying it and instantiating a new one.
  • Explicitly manage PlayerInput.user assignments, ensuring each new character receives a distinct user associated with its input devices.
  • Verify Input System Package settings to confirm the maximum number of players or Input Users is configured to support the required player count.

Editor's Note:

The above fixes have not been verified by our audit team yet. They are provided exclusively for your own technical research. We recommend creating a backup of your project before proceeding with any attempts. Utilize at your own discretion!

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.