-
Notifications
You must be signed in to change notification settings - Fork 326
FIX: InputControl is not updated from the first time [ISXB-1221] #2221
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
@@ Coverage Diff @@
## develop #2221 +/- ##
===========================================
+ Coverage 68.10% 68.12% +0.01%
===========================================
Files 367 367
Lines 53629 53633 +4
===========================================
+ Hits 36524 36535 +11
+ Misses 17105 17098 -7
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
@@ -161,9 +161,11 @@ public void OnGUI(Rect rect, GUIContent label = null, SerializedProperty propert | |||
|
|||
private void ShowDropdown(Rect rect, SerializedProperty serializedProperty, Action modifiedCallback) | |||
{ | |||
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS | |||
#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was automatic by VSCode
/// It's employed to skip auto-saving, because that complicates updating the internal SerializedProperties. | ||
/// Unfortunately, we can't use IMGUIDropdownVisible from the setings provider because of the early-out logic in there. | ||
/// </summary> | ||
public static bool IsShowingDropdown { get; private set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, that is a static property. However, it's only set from one place (private set), and it won't leak memory. Also, if we somehow happen to have two drop-down editor windows at the same time (which QA will correct me is barely possible). Even if somehow somehow opens two drop-down thingies at the same time, I believe we're fine here, as the more drop-down windows we have, the less sense it makes to auto-save during those sensitive moments of time. Hope that makes sense.
95dbcf9
to
f38d3ae
Compare
I don't think I can make an automated test for this myself, it's rather tricky UI/Editor case involving ImGUI and UIElements among other things. |
@@ -17,7 +17,6 @@ internal class InputActionsEditorSettingsProvider : SettingsProvider | |||
[SerializeField] InputActionsEditorState m_State; | |||
VisualElement m_RootVisualElement; | |||
private bool m_HasEditFocus; | |||
private bool m_IgnoreActionChangedCallback; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was never used, dead code, I'm removing as a harmless side effect.
|
||
private InputControlPickerDropdown m_PickerDropdown; | ||
private readonly InputControlPickerState m_PickerState; | ||
private InputActionRebindingExtensions.RebindingOperation m_RebindingOperation; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These three private properties were never really used, so I'm just cleaning it up as a harmless side effect on my main change.
Description
This aims fixing the problem where the InputControl picker won't apply the selected item every second time basically (only when auto-save was on). To be technically precise, it wasn't applying the selected item every time when the input actions window was dirty, which normally happens in two cases:
The root cause for these issues is that our input picker drop-down menu is technically a separate EditorWindow that steals focus from the input actions window as it's open. This was unfortunate because the input actions window subscribes to focus loss in order to save changes and reload all the state as it does so. Practically, if the input actions window was dirty, you click on the picker, that changes focus and triggers auto-save right there. It re-creates all the backing for the window, but the picker uses SerializedProperties, it doesn't talk to data directly. Because of that, when the new assets are loaded as part of auto-save, it won't pick the right data up.
Hereby we propose to address that by avoiding auto-save at that sensitive moment in time while we're opening the drop-down thing for the input control picker.
Testing status & QA
Local testing, QA pending
Overall Product Risks
Comments to reviewers
Please describe any additional information such as what to focus on, or historical info for the reviewers.
Checklist
Before review:
Changed
,Fixed
,Added
sections.Area_CanDoX
,Area_CanDoX_EvenIfYIsTheCase
,Area_WhenIDoX_AndYHappens_ThisIsTheResult
.During merge:
NEW: ___
.FIX: ___
.DOCS: ___
.CHANGE: ___
.RELEASE: 1.1.0-preview.3
.After merge: