FIX: uum 144337 inputfixture teardown fails to reset input system#2437
FIX: uum 144337 inputfixture teardown fails to reset input system#2437Darren-Kelly-Unity wants to merge 4 commits into
Conversation
| continue; | ||
|
|
||
| map.m_State = this; | ||
| map.m_MapIndexInState = mapIndex; |
There was a problem hiding this comment.
Since TestHook_DisableActions() now explicitly nulls out m_SharedStateForAllMaps on the project-wide action asset, RelinkRestoredStates() needs to restore it here.
Without this, the restored action maps will successfully reconnect their m_State, but their parent InputActionAsset will be left with a null m_SharedStateForAllMaps. This breaks asset-level reactivity: methods like InputActionAsset.bindingMask and InputActionAsset.devices setters rely on ReResolveIfNecessary(), which returns early and does nothing if m_SharedStateForAllMaps == null. As a result, subsequent tests that try to apply overrides to the project-wide asset would see those changes silently ignored.
You can safely restore it using the map's asset reference:
Suggested replacement omitted because it is too large for an inline review comment.
🤖 Helpful? 👍/👎 by bug_hunter_agent
Codecov ReportAttention: Patch coverage is
@@ Coverage Diff @@
## develop #2437 +/- ##
============================================
+ Coverage 58.58% 79.03% +20.45%
============================================
Files 738 767 +29
Lines 135831 140436 +4605
============================================
+ Hits 79570 110989 +31419
+ Misses 56261 29447 -26814 Flags with carried forward coverage won't be shown. Click here to find out more.
|
Purpose of this PR
Fixes two regressions surfaced by UUM-144337:
InputFixture teardown fails to reset the Input System — after
Restore()re-installs the globalInputActionStateregistry, per-map and per-action back-references (m_State,m_MapIndexInState,m_ActionIndexInState) were left stale becauseDestroy()had cleared them. A newRelinkRestoredStates()pass re-links those references and recomputesm_EnabledActionsCountfrom the restored action-phase memory.TestHook_DisableActions()is also changed to null the back-references rather than callDisable(), which was corrupting the saved-state snapshot.Multiple touchscreen input bug on multi-display — touch events were matched solely by
touchId, causing collisions when two displays used the same ID. All touch-slot lookups and event-merge checks now also comparedisplayIndex.TouchSimulationgains am_TouchDisplayIndicesarray to propagate the correctdisplayIndexthrough simulated touch events.Release Notes
InputTestFixtureteardown leavingInputActionMapback-references stale after state restore, causing maps and actions to report incorrect enabled state post-test.touchId, causing phantom or dropped touch inputs in multi-display setups.Functional Testing status
InputTestFixtureTeardownTestscover the teardown/restore regression (editor tests).TouchscreenMultiDisplayTestscover same-touchIdcross-display collision andTouchSimulationdisplayIndexpropagation.Performance Testing Status
No performance impact. Changes are confined to test-fixture teardown paths and touch-slot O(n) linear scans that are already present; only an extra integer comparison is added per iteration.
Overall Product Risks
Touchscreen.OnStateEvent/MergeEventtouch matching is on a hot path, but the change is additive (extra&&condition) and covered by new tests.Class diagram
Changes across
b9b935932~3..HEAD.Class diagram
classDiagram direction TB class InputTestStateManager { +Restore() } class InputActionState { <<partial>> +RelinkRestoredStates()$ -RelinkMapsAndRecomputeEnabledCount() } class InputActionMap { +m_State : InputActionState +m_MapIndexInState : int +m_EnabledActionsCount : int } class InputSystem { +TestHook_DisableActions()$ +TestHook_EnableActions()$ } class Touchscreen { #OnStateEvent() #MergeEvent() } class TouchSimulation { -m_TouchIds : int[] -m_TouchDisplayIndices : byte[] -m_LastTouchId : int +BeginTouch() } InputTestStateManager --> InputActionState : calls RelinkRestoredStates InputActionState --> InputActionMap : relinks m_State + m_MapIndexInState InputSystem --> InputActionMap : nulls m_State on teardown TouchSimulation --> Touchscreen : simulates events on