Skip to content

Conversation

timkeo
Copy link
Collaborator

@timkeo timkeo commented Mar 5, 2024

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

  • Created ControlSchemeCommands.ResetSelectedControlScheme() command to reload InputControlScheme from the SerializedProperty (called during Cancel)
  • Minor refactoring of "Close" methods in ControlSchemesView
  • Added comments explaining current functionality

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 to SelectControlScheme. 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:

  • Changelog entry added.
    • Explains the change in Changed, Fixed, Added sections.
    • For API change contains an example snippet and/or migration example.
    • FogBugz ticket attached, example ([case %number%](https://issuetracker.unity3d.com/issues/...)).
    • FogBugz is marked as "Resolved" with next release version correctly set.
  • Tests added/changed, if applicable.
    • Functional tests Area_CanDoX, Area_CanDoX_EvenIfYIsTheCase, Area_WhenIDoX_AndYHappens_ThisIsTheResult.
    • Performance tests.
    • Integration 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.

@timkeo timkeo requested review from Pauliusd01, ekcoh and ritamerkl March 5, 2024 01:27
Copy link
Collaborator

@ekcoh ekcoh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

…ved values

* Explicitly reload values from the SerializedProperty to ensure UI is reset

* Add comments explaining current functionality
@timkeo timkeo force-pushed the isx-1892-cancel-controlscheme branch from 32db353 to 6e07b35 Compare March 5, 2024 17:15
@timkeo timkeo changed the title FIX: Canceling ControlScheme edits resets the UI to the previously ved values FIX: Canceling ControlScheme edits resets the UI to the previously saved values (ISX-1892) Mar 5, 2024
@ekcoh ekcoh removed the request for review from ritamerkl March 5, 2024 17:43
@timkeo timkeo merged commit 8983693 into develop Mar 5, 2024
@timkeo timkeo deleted the isx-1892-cancel-controlscheme branch March 5, 2024 18:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants