diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index 5d522c7ffd..dd43bc44f4 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -9,6 +9,7 @@ Due to package verification, the latest version below is the unpublished version however, it has to be formatted properly to pass verification tests. ## [Unreleased] - yyyy-mm-dd +- Fixed InputControl picker not updating correctly when the Input Actions Window was dirty. [ISXB-1221](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1221) ### Added - Exposed MediaPlayPause, MediaRewind, MediaForward keys on Keyboard. diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs index 91d10fdc81..a986c2c2b3 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs @@ -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 InputActionsEditorSettingsProvider.SetIMGUIDropdownVisible(true, false); - #endif +#endif + IsShowingDropdown = true; + if (m_PickerDropdown == null) { m_PickerDropdown = new InputControlPickerDropdown( @@ -187,6 +189,8 @@ private void ShowDropdown(Rect rect, SerializedProperty serializedProperty, Acti m_PickerDropdown.SetExpectedControlLayout(m_ExpectedControlLayout); m_PickerDropdown.Show(rect); + + IsShowingDropdown = false; } private void SetExpectedControlLayoutFromAttribute(SerializedProperty property) @@ -206,12 +210,16 @@ private void SetExpectedControlLayoutFromAttribute(SerializedProperty property) private GUIContent m_PathLabel; private string m_ExpectedControlLayout; private string[] m_ControlPathsToMatch; - private InputControlScheme[] m_ControlSchemes; - private bool m_NeedToClearProgressBar; private InputControlPickerDropdown m_PickerDropdown; private readonly InputControlPickerState m_PickerState; - private InputActionRebindingExtensions.RebindingOperation m_RebindingOperation; + + /// + /// This property is only set from this class in order to communicate that we're showing the dropdown at the moment + /// 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. + /// + public static bool IsShowingDropdown { get; private set; } } } #endif // UNITY_EDITOR diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorSettingsProvider.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorSettingsProvider.cs index 3ff81719c3..da4ba2e8dd 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorSettingsProvider.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorSettingsProvider.cs @@ -17,7 +17,6 @@ internal class InputActionsEditorSettingsProvider : SettingsProvider [SerializeField] InputActionsEditorState m_State; VisualElement m_RootVisualElement; private bool m_HasEditFocus; - private bool m_IgnoreActionChangedCallback; private bool m_IsActivated; private static bool m_IMGUIDropdownVisible; StateContainer m_StateContainer; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs index 0928f3c819..d469d1e8e5 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs @@ -344,7 +344,12 @@ private void OnLostFocus() // Auto-save triggers on focus-lost instead of on every change #if UNITY_INPUT_SYSTEM_INPUT_ACTIONS_EDITOR_AUTO_SAVE_ON_FOCUS_LOST if (InputEditorUserSettings.autoSaveInputActionAssets && m_IsDirty) - Save(isAutoSave: true); + // We'd like to avoid saving in case the focus was lost due to the drop-down window being spawned. + // This code should be cleaned up once we migrate the InputControl stuff from ImGUI completely. + // Since at that point it stops being a separate window that steals focus. + // (See case ISXB-1221) + if (!InputControlPathEditor.IsShowingDropdown) + Save(isAutoSave: true); #endif analytics.RegisterEditorFocusOut();