Search Unity

Multiple keyboards

Discussion in 'Input System' started by Robber33, Oct 1, 2019.

  1. Robber33

    Robber33

    Joined:
    Feb 22, 2015
    Posts:
    52
    I'm playing around with the new input system and i like it.
    to do a test i connected 2 keyboards, but the inputSystem reacts to both keyboards as one device.
     
  2. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    The Windows and Mac backends do not yet have multi-mouse/pointer and multi-keyboard support. It's on the list.
     
    Robber33 likes this.
  3. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
  4. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    I don't have a reliable estimate ATM. We'll circle back to more feature work once 1.0 verified is solid but what specifically will get worked on when and in what order is still uncertain.
     
  5. brandonholt95

    brandonholt95

    Joined:
    Feb 12, 2020
    Posts:
    14
    Any update on this? This is now a fundamental feature to have to make Steam remote play usable for most people.
     
    kilik128 likes this.
  6. kilik128

    kilik128

    Joined:
    Jul 15, 2013
    Posts:
    909
    true fundamental feature
    life is multiplayer !
     
  7. stevphie123

    stevphie123

    Joined:
    Mar 24, 2021
    Posts:
    82
    Any update on this?
     
  8. dmytro_at_unity

    dmytro_at_unity

    Unity Technologies

    Joined:
    Feb 12, 2021
    Posts:
    212
  9. stevphie123

    stevphie123

    Joined:
    Mar 24, 2021
    Posts:
    82
    I guess this would work by pooling all connected keyboards


    Code (CSharp):
    1.    
    2. Keyboard[] KeyboardPool;
    3. public void PoolKeyboards()
    4.     {
    5.         var t = InputSystem.devices;
    6.         var y = 0;
    7.  
    8.         KeyboardPool  = new KeyboardPool[t.Length];
    9.  
    10.         foreach (var r in t)
    11.         {
    12.             if (r.name.Contains("Keyboard"))
    13.             {
    14.                     KeyboardPool[y] = r as Keyboard;
    15.             }
    16.         }
    17.          KeyboardPool[0].MakeCurrent();
    18.     }
    19.  
    20. //Check states on Update
    21. void Update()
    22. {
    23.         if (Keyboard.current.anyKey.wasPressedThisFrame)
    24.         {
    25.            //Keyboard 1, do something
    26.         }
    27.      
    28.         if (KeyboardPool[1].anyKey.wasPressedThisFrame)
    29.         {
    30.            //Keyboard 2, do something
    31.          }
    32.  
    33. }
    34.  
     
  10. Nyarthotep

    Nyarthotep

    Joined:
    Sep 22, 2015
    Posts:
    2
    Is there any update on this functionality?