Search Unity

Feedback Players join when join action is Triggered not working when using a reference input action

Discussion in 'Input System' started by GamesbyJP, Dec 17, 2019.

  1. GamesbyJP

    GamesbyJP

    Joined:
    May 20, 2018
    Posts:
    62
    Hello everyone,

    I'm not sure why, but there seems to be a problem where player joining only works for 1 player when using the PlayerInputManager when having specific settings. When I have it set-up like in the picture I attached, I can only join a player the first time I press the A button on any controller I have connected, not the second time.

    However, it works as soon as I tick off the 'Use Reference' setting, and manually add a binding to the action to listen to Button South of a gamepad.
     

    Attached Files:

    hadesfury likes this.
  2. hadesfury

    hadesfury

    Joined:
    Jan 23, 2014
    Posts:
    55
    Same issue .. I really don’t get it. Did you submit a bug report ?
     
  3. GamesbyJP

    GamesbyJP

    Joined:
    May 20, 2018
    Posts:
    62
    Unable to send bugs I'm afraid. The bug reporter crashes every time I try to send a bug report.
    I've made a post about it somewhere on the forums a few weeks ago, but I didn't receive any replies so far.
     
  4. hadesfury

    hadesfury

    Joined:
    Jan 23, 2014
    Posts:
    55
    Last edited: Mar 7, 2020
  5. osum4est

    osum4est

    Joined:
    Jan 26, 2015
    Posts:
    13
    It seems to me like this is what is happening (weirdness with InputActionReference):
    * No players are joined, so the action reference is enabled for all controllers
    * 1 player joins, and the join action now gets bound to the player that just joined. The action can no longer be used with other controllers.

    I have found two workarounds for this:
    1) Clone the action and tell the input manager to use the cloned action for the join action:
    _playerInputManager.joinAction = new InputActionProperty(_playerInputManager.joinAction.action.Clone());
    2) Use a completely separate InputActions asset for actions that shouldn't be tied to players. This is what I've done. I've named that asset "GlobalInputActions" and included actions for player joining, opening my debug console, pausing and ui controls.

    Hopefully this helps you guys until Unity fixes it!
     
    menecats and Zelgadis87 like this.
  6. dudareviv

    dudareviv

    Joined:
    Aug 13, 2014
    Posts:
    1
    Thanks a lot!

    I make "Lobby Actions" with one map and one action for join player. It works for me.
     
  7. Arc-fy

    Arc-fy

    Joined:
    Feb 9, 2020
    Posts:
    7
    This works, but now I get another problem:
    With each press of the join action it will continuously try to join now that the join action isn't bound or consumed. If you have set a maximum player limit, you will be spammed with errors saying the player limit is reached.

    For example if you have the south gamepad button bound as join, but it's also the jump button, then there will be this issue. Without the player limit, on the surface there doesn't appear to be a problem, but debugging reveals the join action event is continuously triggered
     
  8. andrew_oc

    andrew_oc

    Unity Technologies

    Joined:
    Apr 16, 2021
    Posts:
    77
    There is a fix for this incoming here https://github.com/Unity-Technologies/InputSystem/pull/1344.

    This is what is fixed by that pull request, but in the meantime, the workaround suggested by osum4est is to have a completely different action for jump and join. You can even put your join action in a separate action map to keep in-game and UI actions apart.
     
    Arc-fy likes this.
  9. Arc-fy

    Arc-fy

    Joined:
    Feb 9, 2020
    Posts:
    7
    Thank you. Awaiting eagerly for the fix.

    In the example I gave, I forgot to mention the join button and jump button were on different Input Actions Asset, under differently named maps. Just their bindings overlapped to the same button.
     
  10. LeGingerGamer

    LeGingerGamer

    Joined:
    Jan 13, 2017
    Posts:
    4
    Really glad this is being sorted. Trying to implement this too. Impossible to get more than 1 player connecting using this method XD
     
  11. vedupatel2011

    vedupatel2011

    Joined:
    Sep 21, 2021
    Posts:
    1
    I know this is super late but I found that changing the action type in the input manager to "pass through" and the control type to "any" allows multiple players to join when the action is triggered

    also in my case the first player wouldn't be able to jump but the rest were and after changing this every player can jump now