Skip to content

Commit 1abc745

Browse files
authored
CHANGE: Added message to notify the user if a PlayerInputComponent fails to bind a control scheme (ISXB-1020) (#2007)
* Added message to notify the user if a PlayerInputComponent fails to bind a control scheme (ISXB-1020) This can happen if there are multiple game objects with PlayerInputComponent's and not enough devices to support them
1 parent 8fbff9b commit 1abc745

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ however, it has to be formatted properly to pass verification tests.
2121
### Changed
2222
- Renamed editor Resources directories to PackageResources to fix package validation warnings.
2323
- Changed representation of GamepadButton enum values in Inspector to display aliased enum values as a single item to avoid confusion around selection and aliased value display when multiple enum items map to the same numerical value. [ISXB-543](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-543)
24+
- PlayerInput component now warns if the system cannot find matching control scheme, which can occur if all control schemes already paired (e.g. to other game objects with PlayerInput components) [ISXB-1020](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1020)
2425

2526
## [1.11.0] - 2024-09-10
2627

Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInput.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,7 +1463,15 @@ private void AssignUserAndDevices()
14631463
{
14641464
var controlScheme = InputControlScheme.FindControlSchemeForDevices(availableDevices, m_Actions.controlSchemes);
14651465
if (controlScheme != null)
1466+
{
14661467
TryToActivateControlScheme(controlScheme.Value);
1468+
}
1469+
else
1470+
{
1471+
// The device count check is here to allow the unit tests to pass (and not trigger this error message)
1472+
if (InputSystem.devices.Count > 0 && availableDevices.Count == 0)
1473+
Debug.LogWarning($"Cannot find matching control scheme for {this.name} (all control schemes are already paired to matching devices)", this);
1474+
}
14671475
}
14681476
}
14691477
}

0 commit comments

Comments
 (0)