diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index 831b491ec7..43a8034877 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -74,6 +74,7 @@ however, it has to be formatted properly to pass verification tests. - Fixed 3D Vector and 1D Axis binding dropdown usage in Input Actions Editor throwing NotImplementedExceptions. - Fixed several missing tooltips from the Action/Binding Properties pane in Input Actions Editor. - Fixed an issue in the InputActionAsset Editor where ControlType wasn't updated when ActionType changed. +- Fixed an issue in the InputActionAsset Editor where Canceling ControlScheme changes didn't reset the values in the UI. ## [1.8.0-pre.2] - 2023-11-09 diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/ControlSchemeCommands.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/ControlSchemeCommands.cs index efd77de9d3..2db9ead78c 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/ControlSchemeCommands.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/ControlSchemeCommands.cs @@ -131,6 +131,26 @@ public static Command SelectControlScheme(int controlSchemeIndex) }; } + public static Command ResetSelectedControlScheme() + { + return (in InputActionsEditorState state) => + { + var controlSchemeSerializedProperty = state.serializedObject + .FindProperty(nameof(InputActionAsset.m_ControlSchemes)) + .GetArrayElementAtIndex(state.selectedControlSchemeIndex); + + if (controlSchemeSerializedProperty == null) + { + return state.With( + selectedControlSchemeIndex: -1, + selectedControlScheme: new InputControlScheme()); + } + + return state.With( + selectedControlScheme: new InputControlScheme(controlSchemeSerializedProperty)); + }; + } + public static Command SelectDeviceRequirement(int deviceRequirementIndex) { return (in InputActionsEditorState state) => state.With(selectedDeviceRequirementIndex: deviceRequirementIndex); diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ControlSchemesView.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ControlSchemesView.cs index d9152d1375..45686080f2 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ControlSchemesView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ControlSchemesView.cs @@ -25,7 +25,7 @@ public ControlSchemesView(VisualElement root, StateContainer stateContainer, boo InputActionsEditorConstants.ControlSchemeEditorViewUxml); var controlSchemeVisualElement = controlSchemeEditor.CloneTree(); - controlSchemeVisualElement.Q