Search Unity

PlayerInput.Instantiate ignores controller schemes for multiplayer with players on same device

Discussion in 'Input System' started by GabrielSants, Aug 20, 2019.

  1. GabrielSants

    GabrielSants

    Joined:
    Jan 3, 2017
    Posts:
    2
    Hi there,

    I want to make a input manager for a local multiplayer game where multiple players can be controlled by the same device, in this case the keyboard. (but i intend to support gamepads as well)

    But when i use PlayerInput.Instantiate and add different control schemes for every button layout on the keyboard for the different players, if i pair those players with the same device every player will be controlled by all the actions in the different control schemes.

    like this:

    Code (CSharp):
    1. PlayerInput.Instantiate(player, controlScheme: "Keyboard WASD", pairWithDevice: Keyboard.current);
    2.  
    3. PlayerInput.Instantiate(player, controlScheme: "Keyboard Arrows", pairWithDevice: Keyboard.current);

    I've done this following the sollution in this thread: https://forum.unity.com/threads/multiple-control-schemes-or-actions.727583/

    I kinda solved the problem by creating diferent action maps for every button layout in the keyboard and then changing the action map on the playerinput component after the instantiation but this doesn't seems to be the correct way to go about it. Because it requires a lot of setup for more players this kinda was the problem the control schemes was intended to solve, i assume.

    Is there something i'm doing wrong?
     
  2. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Looking into it. Expected to work so suspecting there's a bug. Will get back to you.
     
  3. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
  4. GabrielSants

    GabrielSants

    Joined:
    Jan 3, 2017
    Posts:
    2
    Oh, first time i post on the unity forums and i found a bug. Happy to help!

    Hope the new version get on the package manager soon, keep up the good work!