I’m currently working on setting up some local multiplayer for my game, for which I’m using the PlayerInputManager and PlayerInput scripts. I would like to manually join players, and so I’ve set my PlayerInputManager’s joining behavior to “JoinPlayersManually”, and am calling JoinPlayer in my script.
This works just fine and creates the player prefab when I just set the player index, but when I supply devices to be paired with the player input, it causes the prefab to get automatically deleted.
// This works
_playerInputManager.JoinPlayer(0);
// These cause the player to get instantiated, and immediately deleted
_playerInputManager.JoinPlayer(0, default, default, device);
_playerInputManager.JoinPlayer(0, default, default, InputSystem.devices.ToArray());
I’ve taken a look into the source, and this causes the object to be destroyed immediately because playerInput.user.valid is always false in PlayerInput.DoInstantiate. Has anyone encountered this issue before? I’m not seeing anything online as to what might the cause of the issue be.