FIX: Autosave closes add control scheme ui element on save. (ISXB-1713)
Description
Fix an issue where the control scheme UI would close when pressing the + for adding a device type when there was a pending change to be auto saved.
Ticket: https://jira.unity3d.com/browse/ISXB-1713
Testing status & QA
I have tested this manually in the editor on Unity version 6.000.1.5f1
Overall Product Risks
Please rate the potential complexity and halo effect from low to high for the reviewers. Note down potential risks to specific Editor branches if any.
- Complexity: 2
- Halo Effect: 1
Comments to reviewers
Please describe any additional information such as what to focus on, or historical info for the reviewers.
Checklist
Before review:
- [ ] Changelog entry added.
- Explains the change in
Changed,Fixed,Addedsections. - For API change contains an example snippet and/or migration example.
- JIRA ticket linked, example (case %<ID>%). If it is a private issue, just add the case ID without a link.
- Jira port for the next release set as "Resolved".
- Explains the change in
- [ ] Tests added/changed, if applicable.
- Functional tests
Area_CanDoX,Area_CanDoX_EvenIfYIsTheCase,Area_WhenIDoX_AndYHappens_ThisIsTheResult. - Performance tests.
- Integration tests.
- Functional tests
- [ ] Docs for new/changed API's.
- Xmldoc cross references are set correctly.
- Added explanation how the API works.
- Usage code examples added.
- The manual is updated, if needed.
During merge:
- [ ] Commit message for squash-merge is prefixed with one of the list:
NEW: ___.FIX: ___.DOCS: ___.CHANGE: ___.RELEASE: 1.1.0-preview.3.
After merge:
- [ ] Create forward/backward port if needed. If you are blocked from creating a forward port now please add a task to ISX-1444.
PR Reviewer Guide π
Here are some key observations to aid the review process:
| β±οΈΒ Estimated effort to review: 2 π΅π΅βͺβͺβͺ The PR is small with a clear goal, but it contains leftover debugging code and a concerning TODO comment that need to be addressed. |
| π
Β Score: 70 The PR addresses the bug with a reasonable approach, but it includes several leftover debug logs and a concerning TODO comment that must be removed or clarified before merging. |
| π§ͺΒ No relevant tests |
| πΒ No security concerns identified |
β‘Β Recommended focus areas for reviewDebugging Remnants
Debug.LogError statements that appear to be for debugging purposes (e.g., in Save, and in ControlSchemesView.cs). These should be removed before merging. Using LogError for informational logging can also be misleading. |
π€ Helpful? Please react with π/π | QuestionsβPlease reach out in Slack #ask-u-pr-agent
Codecov Report
Attention: Patch coverage is 0% with 11 lines in your changes missing coverage. Please review.
@@ Coverage Diff @@
## develop #2268 +/- ##
===========================================
- Coverage 77.95% 77.91% -0.04%
===========================================
Files 477 476 -1
Lines 97419 97465 +46
===========================================
- Hits 75943 75941 -2
- Misses 21476 21524 +48
| Flag | Coverage Ξ | |
|---|---|---|
| inputsystem_MacOS_2022.3 | 5.54% <0.00%> (-0.01%) |
:arrow_down: |
| inputsystem_MacOS_2022.3_project | 75.47% <0.00%> (-0.03%) |
:arrow_down: |
| inputsystem_MacOS_6000.0 | 5.32% <0.00%> (-0.01%) |
:arrow_down: |
| inputsystem_MacOS_6000.0_project | 77.36% <0.00%> (-0.06%) |
:arrow_down: |
| inputsystem_MacOS_6000.2 | 5.32% <0.00%> (-0.01%) |
:arrow_down: |
| inputsystem_MacOS_6000.2_project | 77.36% <0.00%> (-0.05%) |
:arrow_down: |
| inputsystem_MacOS_6000.3 | 5.32% <0.00%> (-0.01%) |
:arrow_down: |
| inputsystem_MacOS_6000.3_project | 77.36% <0.00%> (-0.06%) |
:arrow_down: |
| inputsystem_MacOS_6000.4 | 5.32% <0.00%> (-0.01%) |
:arrow_down: |
| inputsystem_MacOS_6000.4_project | 77.36% <0.00%> (-0.01%) |
:arrow_down: |
| inputsystem_MacOS_6000.5 | 5.32% <0.00%> (-0.01%) |
:arrow_down: |
| inputsystem_MacOS_6000.5_project | 77.36% <0.00%> (-0.06%) |
:arrow_down: |
| inputsystem_Ubuntu_2022.3 | 5.54% <0.00%> (-0.01%) |
:arrow_down: |
| inputsystem_Ubuntu_2022.3_project | 75.27% <0.00%> (-0.03%) |
:arrow_down: |
| inputsystem_Ubuntu_6000.0 | 5.32% <0.00%> (-0.01%) |
:arrow_down: |
| inputsystem_Ubuntu_6000.0_project | 77.16% <0.00%> (-0.06%) |
:arrow_down: |
| inputsystem_Ubuntu_6000.2 | 5.32% <0.00%> (-0.01%) |
:arrow_down: |
| inputsystem_Ubuntu_6000.2_project | 77.16% <0.00%> (-0.06%) |
:arrow_down: |
| inputsystem_Ubuntu_6000.3 | 5.32% <0.00%> (-0.01%) |
:arrow_down: |
| inputsystem_Ubuntu_6000.3_project | 77.16% <0.00%> (-0.06%) |
:arrow_down: |
| inputsystem_Ubuntu_6000.4 | 5.33% <0.00%> (-0.01%) |
:arrow_down: |
| inputsystem_Ubuntu_6000.4_project | 77.17% <0.00%> (-0.06%) |
:arrow_down: |
| inputsystem_Ubuntu_6000.5 | 5.33% <0.00%> (-0.01%) |
:arrow_down: |
| inputsystem_Ubuntu_6000.5_project | 77.17% <0.00%> (-0.06%) |
:arrow_down: |
| inputsystem_Windows_2022.3 | 5.54% <0.00%> (-0.01%) |
:arrow_down: |
| inputsystem_Windows_2022.3_project | 75.60% <0.00%> (-0.03%) |
:arrow_down: |
| inputsystem_Windows_6000.0 | 5.32% <0.00%> (-0.01%) |
:arrow_down: |
| inputsystem_Windows_6000.0_project | 77.49% <0.00%> (-0.06%) |
:arrow_down: |
| inputsystem_Windows_6000.2 | 5.32% <0.00%> (-0.01%) |
:arrow_down: |
| inputsystem_Windows_6000.2_project | 77.49% <0.00%> (-0.06%) |
:arrow_down: |
| inputsystem_Windows_6000.3 | 5.32% <0.00%> (-0.01%) |
:arrow_down: |
| inputsystem_Windows_6000.3_project | 77.48% <0.00%> (-0.06%) |
:arrow_down: |
| inputsystem_Windows_6000.4 | 5.32% <0.00%> (-0.01%) |
:arrow_down: |
| inputsystem_Windows_6000.4_project | 77.49% <0.00%> (-0.05%) |
:arrow_down: |
| inputsystem_Windows_6000.5 | 5.32% <0.00%> (-0.01%) |
:arrow_down: |
| inputsystem_Windows_6000.5_project | 77.49% <0.00%> (-0.05%) |
:arrow_down: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Files with missing lines | Coverage Ξ | |
|---|---|---|
| ...or/UITKAssetEditor/Views/InputActionsEditorView.cs | 53.25% <0.00%> (+9.02%) |
:arrow_up: |
| ...KAssetEditor/InputActionsEditorSettingsProvider.cs | 0.00% <0.00%> (ΓΈ) |
|
| ...Editor/UITKAssetEditor/InputActionsEditorWindow.cs | 54.20% <0.00%> (-0.94%) |
:arrow_down: |
... and 14 files with indirect coverage changes
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
It still reproduces with project wide actions view but if it is complicated to fix I'd be fine with merging as is.
Steps to repro: Open project settings -> input system view -> make sure you have a PWA asset if not make one -> make some changes (this window always uses auto save) -> start editing the control scheme as bug repro describes -> focus is lost
https://github.com/user-attachments/assets/f3dfcffa-075c-46d2-a11a-75da6946f51a
Thanks for doing this fix @Darren-Kelly-Unity. The staticness of these states look a bit dangerous to me, but if it solves the problem lets land this fix since it quite condensed.
I actually changed it now due to a comment from Rita asking about with two windows open, now I just check the view to see if the ControlScheme is currently active for each instance which is better.
/test_plan
Test Plan
- [ ] Test plan approved by PR author
- [ ] Test execution in progress
- [x] Test execution complete
- [x] Ready for merge
Summary of Changes & Risk Assessment
Summary of Changes
This PR fixes a bug (ISXB-1713) where the "Add Control Scheme Device Type" UI element would unexpectedly close when autosave was triggered in the Input Actions Editor window. The fix works by preventing autosave in InputActionsEditorWindow.cs and InputActionsEditorSettingsProvider.cs when the ControlSchemesView is active for that specific editor instance. A new IsControlSchemeViewActive() method was added to InputActionsEditorView.cs to facilitate this check.
Risk Assessment
- High Risk Areas: None identified.
- Medium Risk Areas:
- Potential for autosave not triggering when it should, if the
IsControlSchemeViewActive()check is overly broad or incorrect. - The fix does not fully resolve the issue for Project Wide Actions (PWA) opened via Project Settings, as noted in the PR comments.
- Potential for autosave not triggering when it should, if the
- Low Risk Areas:
- Minor changes to
Debug.LogWarningmessage. - Leftover debugging logs and a TODO comment in the PR code are noted as needing removal before merge, but don't pose functional risk.
- Minor changes to
Test Scenarios
Functional Testing
- [x] Verify Fix (Standalone Editor Window):
- Create a new
Input Action Asset. - Open it in a standalone
Input Actions Editor Window. - Add an Action Map and an Action.
- Go to the "Control Schemes" tab.
- Click the '+' button to add a new control scheme.
- In the new control scheme, click '+' next to 'Device Type' to open the "Add Control Scheme Device Type" popup.
- Make a change that would typically trigger autosave (e.g., click outside the popup to dirty the asset, but keep the popup focused).
- Expected: The "Add Control Scheme Device Type" popup remains open and does not close due to autosave.
- Create a new
- [x] Verify Known Limitation (Project Wide Actions in Project Settings):
- Open "Project Settings" -> "Input System Package".
- Ensure a Project Wide Actions (PWA) asset is selected or create one.
- Make some changes to dirty the asset (Project Settings always uses autosave).
- Go to the "Control Schemes" tab.
- Click the '+' button to add a new control scheme.
- In the new control scheme, click '+' next to 'Device Type' to open the "Add Control Scheme Device Type" popup.
- Make a change that would typically trigger autosave (e.g., just navigate around in the editor window).
- Expected: The "Add Control Scheme Device Type" popup will still close unexpectedly. (This confirms the known limitation from Pauliusd01's comment).
- [x] Autosave Functionality (General):
- Create an
Input Action Asset. - Open it in the
Input Actions Editor Window. - Make a change (e.g., add an action).
- Close the window or unfocus Unity to trigger autosave.
- Re-open the asset.
- Expected: The changes are saved correctly, and autosave functions as expected when the control scheme UI is not active.
- Create an
Regression Testing
- [x] Manual Save Functionality:
- Open an
Input Action Assetin the editor. - Make changes.
- Manually save the asset (Ctrl+S or File -> Save).
- Expected: Changes are saved, and no errors occur.
- Open an
- [x] Multiple Editor Windows:
- Open two different
Input Action Assetsin two separateInput Actions Editor Windows. - In one window, open the "Add Control Scheme Device Type" popup.
- In the other window, make a change to trigger autosave.
- Expected: The autosave in the second window completes successfully without closing the popup in the first window.
- Open two different
- [x] Autosave Disabled:
- Disable autosave for Input Action Assets in project settings.
- Replicate the steps for "Verify Fix (Standalone Editor Window)".
- Expected: The "Add Control Scheme Device Type" popup remains open, and no autosave attempts are made (as expected when autosave is disabled).
π‘ This test plan updates automatically when /test_plan is run on new commits. If you have any feedback, please reach out in #ai-qa
π€ Helpful? Please react with π/π | QuestionsβPlease reach out in Slack #ask-u-pr-agent