FIX: Canceling ControlScheme edits resets the UI to the previously saved values (ISX-1892) #1874
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The issue occurred because, although the changes weren't persisted to the SerializedProperty, the UI was still holding changes, and if the ControlScheme Edit dialog is re-opened (without changing ControlSchemes) the old values are displayed. We must explicitly reset the
InputControlScheme
in the ViewState to the last saved values.Changes made
ControlSchemeCommands.ResetSelectedControlScheme()
command to reloadInputControlScheme
from the SerializedProperty (called during Cancel)ControlSchemesView
Notes
I don't know if the current functionality is what we want or not, and so I added verbose comments explaining how it works now. We can change it later if not to everyone's liking.
The new
ResetSelectedControlScheme()
command is nearly identical toSelectControlScheme
. I decided this was the safer route for now, but maybe there's a better way.I only did the most basic of testing before opening this PR.
Checklist
Before review:
Changed
,Fixed
,Added
sections.([case %number%](https://issuetracker.unity3d.com/issues/...))
.Area_CanDoX
,Area_CanDoX_EvenIfYIsTheCase
,Area_WhenIDoX_AndYHappens_ThisIsTheResult
.During merge:
NEW: ___
.FIX: ___
.DOCS: ___
.CHANGE: ___
.RELEASE: 1.1.0-preview.3
.