Search Unity

Player Input Manager spawn too many players

Discussion in 'Input System' started by AlphaDreams, Jul 9, 2019.

  1. AlphaDreams

    AlphaDreams

    Joined:
    Jan 21, 2015
    Posts:
    30
    Hi !

    I just created an empty project in order to test the new Input System.
    I initialized a Player Input Manager, with a player prefab (with a Player Input component on it) referenced.

    When I press a button on a keyboard, or on a gamepad, a new Player is instantiated. So far, everything's fine.

    But if I click and move my mouse without releasing the left button, a new Player is created each frame !

    This is some screenshots of my gameobjects :






    Also, it seems that these multiple players instantiated didn't have any device linked (there is no "Debug" in their PlayerInput component)... Maybe that's why ?

    I'm using Unity 2019.1.9f1, with the Input System Package v0.2.10
     
  2. DementePH

    DementePH

    Joined:
    Feb 20, 2017
    Posts:
    7
    I'm also experiencing this. This only happens when I have a Control Scheme. The issue doesn't happen when I don't have any Control Schemes. I need them though to get the mouse and keyboard to work together :/
     
  3. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Are the devices used in those control schemes listed in the requirements? When control schemes are present, PlayerInput will entirely rely on the requirements on those control schemes to decide what to pair.

    Does sound, though, like we have a case where the setup can lead to joining not resulting in the respective device getting paired at all and neither PlayerInput nor PlayerInputManager detecting the mismatch. Could you post your .inputactions file?
     
  4. DementePH

    DementePH

    Joined:
    Feb 20, 2017
    Posts:
    7
    I'm not sure what happened, but I tried to recreate my setup earlier before sending my .inputactions and now it works. I think it helped when I only required the joystick (which triggered my movement) and kept the buttons (that switch between gamepad and twin usb gamepad) optional.
     
  5. Arrhythmia

    Arrhythmia

    Joined:
    Mar 1, 2020
    Posts:
    6
    What requirements?
     
  6. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Each control scheme has a list of devices it requires (though some may be optional).

    upload_2020-3-16_12-3-50.png
     
  7. Arrhythmia

    Arrhythmia

    Joined:
    Mar 1, 2020
    Posts:
    6
    You're a bloody lifesaver. (Still having more issues though, but not related so I'm off to post a new post.)
    Thanks man.
     
  8. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    :)

    Sidenote... that screenshot makes me realize, we're not even *saying* in there that the list there is a list of devices required by the scheme. Think that UI could use some tweaking to make this more obvious. I'll have a look.
     
    Lars-Steenhoff and GrayedFox like this.
  9. MarNevGames

    MarNevGames

    Joined:
    Feb 1, 2016
    Posts:
    2
    I had a similar bug which I solved, the problem was that if I connect my ps4 input device, and I choose gamepad binding instead of PS4 controller, InputManager generate 2 clones of one input. Just change gamepad to ps4 controller or xbox controller and works. :)
     
  10. Danielfibe

    Danielfibe

    Joined:
    Dec 11, 2019
    Posts:
    1
    Thank you, dude, was struggling with the same problem here and just came across your comment!