Second Player Cannot Navigate the Menu


I am using the new input system in my game. In my main menu scene I have created a menu using UI buttons and player can navigate up and down in this menu and eventually select/press the button he wants. However, when the second player joins the game (by pressing a button on his controller) he cannot navigate the menu. I can see that the player joins successfully so that’s not the problem. Also if I disable joining on Player Input Manager, the second player can also navigate the menu.

Based on what I have understood so far, I can tell that the Input System UI Input Module gets attached automatically to the first PlayerInput instance (created when the first player joins) and it won’t receive inputs from the next instances of the PlayerInput. To me this is a weird behavior because it totally affects the logic of the UI and forces lots of scripting and hacking.

Example: Suppose I disable joining in the first menu. Then user moves to the next screen in which players should join to select their avatars which leads to a couple of PlayerInputs get created. Then if players decide to go back to the main menu, I have to destroy all the PlayerInputs to make the menu works normally. Destroying PlayerInputs in this scenario is not that complicated but suppose after choosing the avatars, players go to the next menu in which they want to choose the map of the level. In this menu, only the player attached to the first PlayerInput can choose the map; If I want to allow other players choose the map I have to write lots of scripts and do some hacks.

I really hope I am doing something wrong and there be a simple solution to this problem.



After a bit of more investigation I realized something: The InputSystemUIInputModule and the first PlayerInput (and probably any other component which their InputActionAsset field is assigned by the input system automatically) point to a same InputActionAsset instance. So basically my initial solution to clear the devices and bindingMask properties of the actionsAsset in InputSystemUIInputModule was not a good solution as it causes the PlayerInput acts weirdly. The solution I am using now is to create a new instance of the InputActionAsset and assign it to the InputSystemUIInputModule.

I believe there are a couple of issues involved in this problem:

  1. The documentation does not say anything about this behavior; I couldn’t see anywhere in the documentation that says - for example : “As long as there are not PlayerInputs in the system the InputSystemUIInputModule listens to all the inputs from all the controllers but as soon as a PlayerInput gets instantiated the input module will only listen to device attached to that `PlayerInput.”
  2. To me this behavior - even if it was documented - is a bit weird; Basically this behavior means that the UI can only get navigated by the first controller (not necessarily the first player) who joins the game. In other words if I created a single player game and start to navigate the menus with my gamepad but then change my mind and start using the keyboard as the main controller I won’t be able to navigate the UI/menus. The same thing can happen in a multiplayer game as well.

I will accept this comment as the answer in order to help anyone else who might face this problem but I think this can be considered as a bug too.

I narrowed the problem a little bit; I can see the devices and bindingMask properties of the actionsAsset property of InputSystemUIInputModule point to only one of the controllers. When I set both of these properties to null the input module responses to all the controllers.

So the question here is: Who set the devices and bindingMask properties of actionsAsset and why? Is this a bug?