-
Notifications
You must be signed in to change notification settings - Fork 331
FIX: IndexOutOfRangeException when enabling InputActionMap. (ISXB-1767) #2296
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Changes from all commits
529b2d2
04fa062
6a11944
d4b0ba4
5ac1292
f939171
4c9cec5
3ebbcd6
870b1e9
96dbc19
92fd00c
a2452e9
8b6c538
0fd8a81
a9714c4
bd6d489
f36b846
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1153,6 +1153,13 @@ | |
| if (IsControlEnabled(controlIndex)) | ||
| continue; | ||
|
|
||
| // We might end up here if an action map is enabled from e.g. an event processing callback such as | ||
| // InputAction.cancel event handler (ISXB-1767). In this case we must skip controls associated with | ||
| // a device that is not connected to the system (Have deviceIndex < 0). We check this here to not | ||
| // cause side effects if aborting later in the call-chain. | ||
| if (!controls[controlIndex].device.added) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could a similar thing happen if a device were disabled?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought so which is why I extended the test to disable, enable, disable, enable but this seems to be fine. I have to admit why this is not clear and would also feel better by doing this symmetric. Should we explore making it symmetric or what do you think? |
||
| continue; | ||
|
|
||
| var bindingIndex = controlIndexToBindingIndex[controlIndex]; | ||
| var mapControlAndBindingIndex = ToCombinedMapAndControlAndBindingIndex(mapIndex, controlIndex, bindingIndex); | ||
|
|
||
|
|
@@ -1474,8 +1481,18 @@ | |
| if (m_OnBeforeUpdateHooked) | ||
| bindingStatePtr->initialStateCheckPending = false; | ||
|
|
||
| // Store magnitude. We do this once and then only read it from here. | ||
| var control = controls[controlIndex]; | ||
|
|
||
| // We might end up here if an action map is enabled from e.g. an event processing callback such as | ||
| // InputAction.cancel event handler (ISXB-1767). In this case we must skip controls associated with | ||
| // a device that is not connected to the system (Have deviceIndex < 0). We check this here to not | ||
| // cause side effects if aborting later in the call-chain. | ||
| if (control == null || !controls[controlIndex].device.added) | ||
| { | ||
| return; | ||
|
Check warning on line 1492 in Packages/com.unity.inputsystem/InputSystem/Actions/InputActionState.cs
|
||
| } | ||
|
|
||
| // Store magnitude. We do this once and then only read it from here. | ||
| trigger.magnitude = control.CheckStateIsAtDefault() ? 0f : control.magnitude; | ||
| controlMagnitudes[controlIndex] = trigger.magnitude; | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.