1
\$\begingroup\$

I'm trying to use the PlayerInputManager of the new InputSystem (preview 7) and my keyboard and mouse are being detected as separate devices. I'm not saying that it is wrong, but it is not useful at all and I would like to know how to fix it.

As shown in this video, the PlayerInputManager has the ability of Instantiating new players when they press a button of their controller. This is almost exactly what I need, but it is not perfect.

All works fine using controllers but if someone wants to join using the keyboard/mouse, "they won't be able".

When a key is pressed in the keyboard, a player joins, and when the mouse is used, another player joins (despite the fact that in that game youn need both to control a character and neither one of the spawned characters would be playable).

So my question is: how can I configure the InputSystem so that only one player joins when either a keyboard or mouse is used and it reads the input from both devices?

Maybe it is simply a missing feature, but I think that it would be nice if you could achieve what I want because a lot of times the keyboard is used alongside a mouse.

Thanks in advance!

\$\endgroup\$
1
  • \$\begingroup\$ Can you show us the code that's causing the keyboard and mouse to join as separate players? We can likely fix that as a special case. \$\endgroup\$
    – DMGregory
    Apr 22, 2020 at 11:11

1 Answer 1

1
\$\begingroup\$

This was solved in the unity forum in this post: https://forum.unity.com/threads/how-to-detect-the-keyboard-and-the-mouse-as-the-same-input-device.873934/#post-5749564

I copy the Rene-Damm's answer (to avoid the link from breaking):

For this to work, you'll need to use control schemes. Without control schemes, PlayerInput won't know which devices go together.

Use the button in the top left corner to add control schemes. Use the button in the top left corner to add control schemes.

In the popup, add both a keyboard and mouse for the keyboard&mouse control scheme. In the popup, add both a keyboard and mouse for the keyboard&mouse control scheme.

Use the control scheme matrix in the bindings properties pane to associate existing bindings with control schemes. Use the control scheme matrix in the bindings properties pane to associate existing bindings with control schemes.

\$\endgroup\$
0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .