Skip to content
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Packages/com.unity.inputsystem/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ however, it has to be formatted properly to pass verification tests.
- Fixed the compilation warnings when used with Unity 6.4 (ISX-2349).
- Fixed an issue where `InputSystemUIInputModule.localMultiPlayerRoot` could not be set to `null` when using `MultiplayerEventSystem`. [ISXB-1610](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1610)
- Fixed an issue in `Keyboard` where the sub-script operator would return a `null` key control for the deprecated key `Key.IMESelected`. Now, an aliased `KeyControl`mapping to the IMESelected bit is returned for compability reasons. It is still strongly advised to not rely on this key since `IMESelected` bit isn't strictly a key and will be removed from the `Key` enumeration type in a future major revision. [ISXB-1541](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1541).
- Fixed an ArgumentOutOfRangeException that was thrown when pressing the undo shortcut while changing a control scheme name. [ISXB-1607](https://issuetracker.unity3d.com/issues/argumentoutofrangeexception-error-is-thrown-when-pressing-the-undo-shortcut-while-changing-the-control-scheme-name)

## [1.14.2] - 2025-08-05

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,16 @@
{
return (in InputActionsEditorState state) =>
{
var controlSchemeSerializedProperty = state.selectedControlSchemeIndex == -1 ? null :
state.serializedObject
.FindProperty(nameof(InputActionAsset.m_ControlSchemes))
.GetArrayElementAtIndex(state.selectedControlSchemeIndex);
SerializedProperty controlSchemeSerializedProperty = null;
var serializedProperty = state.serializedObject

Check warning on line 149 in Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/ControlSchemeCommands.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/ControlSchemeCommands.cs#L148-L149

Added lines #L148 - L149 were not covered by tests
.FindProperty(nameof(InputActionAsset.m_ControlSchemes));

if (state.selectedControlSchemeIndex < serializedProperty.arraySize)
{
controlSchemeSerializedProperty = state.selectedControlSchemeIndex == -1 ? null :

Check warning on line 154 in Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/ControlSchemeCommands.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/ControlSchemeCommands.cs#L152-L154

Added lines #L152 - L154 were not covered by tests
serializedProperty
.GetArrayElementAtIndex(state.selectedControlSchemeIndex);
}

Check warning on line 157 in Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/ControlSchemeCommands.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/ControlSchemeCommands.cs#L157

Added line #L157 was not covered by tests

if (controlSchemeSerializedProperty == null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ private void RemoveDeviceRequirement()
public override void RedrawUI(InputControlScheme viewState)
{
rootElement.Q<TextField>(kControlSchemeNameTextField).value = string.IsNullOrEmpty(m_NewName) ? viewState.name : m_NewName;

m_ListView.itemsSource?.Clear();
m_ListView.itemsSource = viewState.deviceRequirements.Count > 0 ?
viewState.deviceRequirements.Select(r => (r.controlPath, r.isOptional)).ToList() :
Expand All @@ -128,7 +127,7 @@ private void SaveAndClose()
CloseView();
}

private void Cancel()
internal void Cancel()
{
// Reload the selected ControlScheme values from the SerilaizedProperty and throw away any changes
Dispatch(ControlSchemeCommands.ResetSelectedControlScheme());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using UnityEditor;
using UnityEditor.UIElements;
using UnityEngine.UIElements;
Expand All @@ -24,6 +25,8 @@

private readonly Action m_SaveAction;

private ControlSchemesView m_ControlSchemesView;

public InputActionsEditorView(VisualElement root, StateContainer stateContainer, bool isProjectSettings,
Action saveAction)
: base(root, stateContainer)
Expand Down Expand Up @@ -104,6 +107,27 @@
});

s_OnPasteCutElements.Add(this);

Undo.undoRedoPerformed += CheckForInvalidControlSchemeInOneFrame;
}

private async void CheckForInvalidControlSchemeInOneFrame()
{

Check warning on line 115 in Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionsEditorView.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionsEditorView.cs#L115

Added line #L115 was not covered by tests
try
{
await Task.Delay(1);
var state = stateContainer.GetState();
var viewState = ViewStateSelector.GetViewState(state);
var elementAtOrDefault = viewState.controlSchemes?.ElementAtOrDefault(viewState.selectedControlSchemeIndex);
if (viewState.selectedControlSchemeIndex != -1 && elementAtOrDefault == default(InputControlScheme))
{
m_ControlSchemesView?.Cancel();
}
}
catch (Exception e)
{
Debug.LogException(e);
}

Check warning on line 130 in Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionsEditorView.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionsEditorView.cs#L117-L130

Added lines #L117 - L130 were not covered by tests
}

private void OnReset()
Expand Down Expand Up @@ -156,9 +180,8 @@

if (viewState.controlSchemes.Any())
{
m_ControlSchemesToolbar.text = viewState.selectedControlSchemeIndex == -1
? "All Control Schemes"
: viewState.controlSchemes.ElementAt(viewState.selectedControlSchemeIndex).name;
var elementAtOrDefault = viewState.controlSchemes.ElementAtOrDefault(viewState.selectedControlSchemeIndex);
m_ControlSchemesToolbar.text = elementAtOrDefault == default ? "All Control Schemes" : elementAtOrDefault.name;

Check warning on line 184 in Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionsEditorView.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionsEditorView.cs#L183-L184

Added lines #L183 - L184 were not covered by tests

m_ControlSchemesToolbar.menu.AppendAction("All Control Schemes", _ => SelectControlScheme(-1),
viewState.selectedControlSchemeIndex == -1 ? DropdownMenuAction.Status.Checked : DropdownMenuAction.Status.Normal);
Expand Down Expand Up @@ -186,7 +209,7 @@
return;
}
m_DevicesToolbar.SetEnabled(true);
var currentControlScheme = viewState.controlSchemes.ElementAt(viewState.selectedControlSchemeIndex);
var currentControlScheme = viewState.controlSchemes.ElementAtOrDefault(viewState.selectedControlSchemeIndex);

Check warning on line 212 in Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionsEditorView.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionsEditorView.cs#L212

Added line #L212 was not covered by tests
if (viewState.selectedDeviceIndex == -1)
m_DevicesToolbar.text = "All Devices";

Expand Down Expand Up @@ -228,10 +251,13 @@

private void ShowControlSchemeEditor(VisualElement parent, bool updateExisting = false)
{
var controlSchemesView = CreateChildView(new ControlSchemesView(parent, stateContainer, updateExisting));
controlSchemesView.UpdateView(stateContainer.GetState());

controlSchemesView.OnClosing += _ => DestroyChildView(controlSchemesView);
m_ControlSchemesView = CreateChildView(new ControlSchemesView(parent, stateContainer, updateExisting));
m_ControlSchemesView.UpdateView(stateContainer.GetState());
m_ControlSchemesView.OnClosing += _ =>
{
DestroyChildView(m_ControlSchemesView);
m_ControlSchemesView = null;
};

Check warning on line 260 in Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionsEditorView.cs

View check run for this annotation

Codecov GitHub.com / codecov/patch

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionsEditorView.cs#L254-L260

Added lines #L254 - L260 were not covered by tests
}

private void SelectControlScheme(int controlSchemeIndex)
Expand All @@ -258,6 +284,7 @@
{
base.DestroyView();
s_OnPasteCutElements.Remove(this);
Undo.undoRedoPerformed -= CheckForInvalidControlSchemeInOneFrame;
}

public void OnPaste(InputActionsEditorState state)
Expand Down