Player input Manager joining

I’ve been in the process of creating a little prototype so I can get used to the new Input System.

I’ve added the player Input Manager on a Game Object, hooked up the onPlayerJoined, onPlayerLeft

Created a Test Player Prefab with a PlayerInput Attached and I’ve used the DefaultInputActions in the PlayerInput Plugs folder, just for messing around.

Default Map = Player
Default Scheme = GamePad.

What I can’t figure out is why the Player Input Manager is adding a player via the left Mouse button.

I’ve got “Join Player When Button is Pressed”

but how do I only allow Gamepads to join?

1 Like

Figured it Out

On the Player Input Manager

A) - Set the Join Behavior “Join Players When Join Action Is Triggered”

B) - Now click the plus to the right of the Action Bar

C) - Select Add Binding

Usually, if you’re using a Gamepad it’s the south Button that will do the joining.

D) - Press the listen button, press the A button on XBOX Controller and that’s it.

I hope this helps others.

2 Likes

I am using Join action but with gamepad it disconnects as soon as it connects. I get the OnPlayerLeft callback immediatly after OnPlayerJoined.

EDIT: I found the issue. Silly of me. I forgot to add the gamepad device to the Gamepad scheme.

Q: How to setup PlayerInputManager to only allow Gamepads to join?
A: Another option is to setup control schemes for only Gamepads. Adding control schemes is explained at 24:34 into this video https://youtu.be/Yjee_e4fICc?t=1474 .

This works because PlayerInputManager looks on the PlayerPrefab for a PlayerInput component’s Action field. If there are ControlSchemes setup on that input action asset, PlayerInputManager accepts only those device types.

1 Like