Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug PlayerInputManager.DisableJoining() doesn't trigger PlayerInput.StartListeningForDeviceChange()

Discussion in 'Input System' started by downstroypvp, Sep 9, 2022.

  1. downstroypvp

    downstroypvp

    Joined:
    May 30, 2016
    Posts:
    35
    I am using the latest InputSystem package (1.4.2)

    I guess this is an oversight (or I am using it completely wrong), but this portion of the code from the PlayerInput is only called OnEnable(), which leads to problems (new device not detected by the current (and only) user) if PlayerInputManager.DisableJoining() is called with only one player active:

    Code (CSharp):
    1.          
    2.  
    3.         private void OnEnable()
    4.         {
    5.             ...
    6.             // In single player, set up for automatic device switching.
    7.             if (isSinglePlayer)
    8.             {
    9.                 if (m_Actions != null && m_Actions.controlSchemes.Count == 0)
    10.                 {
    11.                     // No control schemes. We pick up whatever is compatible with the bindings
    12.                     // we have.
    13.                     StartListeningForDeviceChanges();
    14.                 }
    15.                 else if (!neverAutoSwitchControlSchemes)
    16.                 {
    17.                     // We have control schemes so we only listen for unpaired device *input*, i.e.
    18.                     // actual use of an unpaired device (as opposed to it merely getting plugged in).
    19.                     StartListeningForUnpairedDeviceActivity();
    20.                 }
    21.             }
     
    Last edited: Sep 9, 2022
  2. downstroypvp

    downstroypvp

    Joined:
    May 30, 2016
    Posts:
    35
    Looks like it was a configuration problem on my end, everything is working as expected.