UnityTechnologies / InputSystem_Warriors

Example Project for the new Unity Input System
563 stars 128 forks source link

Setting `Number of Players` to more than one with only one input device throws an error #3

Open bradweiers opened 4 years ago

bradweiers commented 4 years ago

The following error is thrown per extra player.

ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Parameter name: index UnityEngine.InputSystem.Utilities.ReadOnlyArray`1[TValue].get_Item (System.Int32 index) (at Library/PackageCache/com.unity.inputsystem@1.0.0-preview.5/InputSystem/Utilities/ReadOnlyArray.cs:117) UIMenuManager.UpdateRebindPlayerPanelList () (at Assets/Scripts/UIMenuManager.cs:34) GameManager.UpdateUIMenuPlayerList () (at Assets/Scripts/GameManager.cs:84) GameManager.SpawnPlayers () (at Assets/Scripts/GameManager.cs:79) GameManager.SetupActivePlayers () (at Assets/Scripts/GameManager.cs:47) GameManager.Start () (at Assets/Scripts/GameManager.cs:30)

andytouch commented 4 years ago

This is generally 'by design' as the spawn logic is a simple For loop Instantiate.

However, I should probably add a toggle for setting an automatic number of warriors to spawn based on number of plugged in devices. Ill leave this issue open until i've done that. :)

simonbroggi commented 3 years ago

I've got the same behaviour as described by @bradweiers

But if I do have multiple controllers connected, only one is used to controll a warrior and the other warrior is controlled by the keyboard.

How do I controll two warriors each with a controller?