FIX: Avoid disabling project-wide actions on shutdown#2346
FIX: Avoid disabling project-wide actions on shutdown#2346AswinRajGopal wants to merge 9 commits into
Conversation
PR Reviewer Guide 🔍(Review updated until commit 0771421)Here are some key observations to aid the review process:
🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr |
PR Code Suggestions ✨Explore these optional code suggestions:
🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr |
|||||||||
Codecov ReportAll modified and coverable lines are covered by tests ✅ @@ Coverage Diff @@
## develop #2346 +/- ##
===========================================
+ Coverage 78.13% 78.83% +0.70%
===========================================
Files 483 760 +277
Lines 98770 138560 +39790
===========================================
+ Hits 77169 109227 +32058
- Misses 21601 29333 +7732 Flags with carried forward coverage won't be shown. Click here to find out more.
|
| UnregisterAction(ref m_ScrollWheelAction, OnScrollWheelPerformed); | ||
|
|
||
| if (m_InputActionAsset != null) | ||
| if (m_InputActionAsset != null && m_InputActionAsset != InputSystem.actions) |
There was a problem hiding this comment.
Do we actually have to disable the actions? I'm not a huge fan of disabling this for a particular asset, like project wide actions. I also think the logic we implemented in the past might not be the most correct.
I believe we should always make sure that the UI action map is enabled when registering the actions. Do you know what's the impact of not disabling this asset for a normal asset?
There was a problem hiding this comment.
@jfreire-unity Thanks for the review, I agree that the current change only addresses the reported bug. I’ll improve the fix so that we explicitly ensure the UI action map is enabled when registering actions, and on unregister we only clean up state owned by the provider instead of disabling shared asset state.
|
/test_plan |
Test Plan
Summary of Changes & Risk AssessmentSummary of ChangesThis PR fixes a bug where the Risk Assessment
Test ScenariosFunctional Testing
Regression Testing
🔍 Regression Deep Dive (additional risks identified)
Edge Cases
💡 This test plan updates automatically when 🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr |
Hi @Pauliusd01 |
|
Sorry I'll try to have a look at this in the next couple of days. Need to "load the context" of this area to make sure we're not introducing any other regression |
|
/crc |
There was a problem hiding this comment.
The review has identified several significant issues that need to be addressed. The current implementation introduces a regression risk with a potential ArgumentException when custom assets are used. Additionally, there is a logic discrepancy in the fix itself that results in disabling portions of the project-wide action asset, which will likely cause the newly added test case to fail. Some minor improvements to test code consistency and maintenance are also recommended.
🤖 Helpful? 👍/👎
Hi @jfreire-unity could you please review this PR? or can you suggest another reviewers from the team to move it forward? it is been a while on my name. Thanks in advance :) |
jfreire-unity
left a comment
There was a problem hiding this comment.
As mentioned in Slack, have a look at the U-PR suggestions to see if they make any sense. And feel free to look if we need to extend the added test to look into the action map that's being disabled.
|
Currently working on U-PR comments, |
|
Persistent review updated to latest commit 0771421 |
PR Code Suggestions ✨No code suggestions found for the PR. |

Description
case: https://issuetracker.unity3d.com/product/unity/issues/guid/UUM-134130
Bug:
UI Toolkit now destroys its internal objects when there is no UI left in the scene, so InputSystemProvider.Shutdown() can run during play. During shutdown we unregister the UI actions, but the old code was
managing the whole action asset. With project-wide actions (InputSystem.actions), that meant we could affect input outside UI. With the default internal asset, not cleaning up at all could leave the UI map
enabled longer than intended.
Fix:
Scope the lifecycle to the UI action map only. On registration, InputSystemProvider now makes sure the UI map is enabled. On unregister/shutdown, it disables only that UI map, and only if this provider
enabled it. This avoids changing the enabled state of unrelated maps in InputSystem.actions while still cleaning up the default/internal UI actions correctly.
Testing status & QA
Added new test.
Verified manually using repro project.
Overall Product Risks
Comments to reviewers
Checklist
Before review:
Changed,Fixed,Addedsections.Area_CanDoX,Area_CanDoX_EvenIfYIsTheCase,Area_WhenIDoX_AndYHappens_ThisIsTheResult.During merge:
NEW: ___.FIX: ___.DOCS: ___.CHANGE: ___.RELEASE: 1.1.0-preview.3.