Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Feedback [ PLAYERINPUT Component ] Bindings lost when device change for a single player

Discussion in 'Input System' started by Maus3rSR, Jul 12, 2019.

  1. Maus3rSR

    Maus3rSR

    Joined:
    Oct 2, 2017
    Posts:
    3
    Hello,

    Unity 2019.1.8f1
    InputSystem preview-0.2.10

    I have a game I'm currently developing, and testing the new Input sytem feature which is really great.

    In this game, I have a online lobby. In this lobby, the local player is considered as a single player for the playerInput component.

    I would like my player to switch the device as he want to interact with the game.
    The control scheme switch automatically when the player change the device used. That suit the needs.

    However, in my playerInput component, I have a default action map.
    When the control scheme switch occured, my bindings of my actions is completely lost and the default action map is not the excepted one.

    My action map
    ActionMapLobby.PNG

    Player input prefab
    PlayerInput_prefab.PNG


    Screenshots of my Input debugger :

    Default state when I launch the scene
    playerinput_default_state.png

    State after I change my device
    playerinput_state_after_auto_switch.png

    Test again when, after change device, I manually reset the default action map

    (on the script that contain the playerinput component)
    Code (CSharp):
    1.  
    2. void OnInputUserChanged(InputUser user, InputUserChange change, InputDevice device)
    3.         {
    4.             if (user != PlayerInput.user || change != InputUserChange.ControlSchemeChanged)
    5.                 return;
    6.  
    7.             if (Debug.isDebugBuild)
    8.                 Debug.Log("[AvatarLobby.OnInputUserChanged] Switch current action map to the default one excepted");
    9.  
    10.             PlayerInput.SwitchCurrentActionMap(PlayerInput.defaultActionMap);
    11.             PlayerInput.PassivateInput();
    12.             PlayerInput.ActivateInput();
    13.         }
    14.  


    playerinput_state_after_auto_switch_and_manually_rebind_actionmap.png

    ===================

    This is a bug ? There is a workaround for this situation ?

    Many thanks.
    Best regards.
     
  2. Maus3rSR

    Maus3rSR

    Joined:
    Oct 2, 2017
    Posts:
    3
    Up ? :s
    My problem is maybe not understeable ?
     
  3. Maus3rSR

    Maus3rSR

    Joined:
    Oct 2, 2017
    Posts:
    3
    Fixed with the last releases package (0.9).

    However, only the "XInputControllerWindows/dpad/right" does not work.