Skip to content

Commit 72c33d2

Browse files
committed
FIX: UITK Listen button not working with Any control types (#1788)
* FIX: UITK Listen button not working with Any control types * Remove jira links for ISX project issues from changelog
1 parent fe15451 commit 72c33d2

File tree

4 files changed

+12
-12
lines changed

4 files changed

+12
-12
lines changed

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,11 @@ however, it has to be formatted properly to pass verification tests.
3535
- Fixed case [ISXB-580](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-580) (UI Submit / Cancel not working with Switch Pro controller) by adding "Submit" & "Cancel" usages to the Switch Pro controller input controls.
3636
- Fixed an issue where undoing deletion of Action Maps did not restore Actions correctly.
3737
- Fixed case [ISXB-628](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-628) (OnIMECompositionChange does not return an empty string on accept when using Microsoft IME) by clarifying expectations and intended usage for the IME composition change event.
38-
- Fixed case [ISX-1626](https://jira.unity3d.com/browse/ISX-1626) where the expanded/collapsed state of items in the input action editor was not properly saved between rebuilds of the UI.
39-
- Fixed case [ISX-1668] (The Profiler shows incorrect data and spams the console with "Missing Profiler.EndSample" errors when there is an Input System Component in Scene).
40-
- Fixed [ISX-1661](https://jira.unity3d.com/browse/ISX-1661) where undoing duplications of action maps caused console errors
38+
- Fixed issue where the expanded/collapsed state of items in the input action editor was not properly saved between rebuilds of the UI.
39+
- Fixed issue where The Profiler shows incorrect data and spams the console with "Missing Profiler.EndSample" errors when there is an Input System Component in Scene).
40+
- Fixed an issue where undoing duplications of action maps caused console errors.
4141
- Fix for BindingSyntax `WithInteraction()` which was incorrectly using processors.
42+
- Fix for UITK Input Action Editor binding 'Listen' button which wasn't working in the case for Control Type 'Any'.
4243
- Fixed issue of visual elements being null during editing project-wide actions in project settings which prompted console errors.
4344

4445

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/Commands.cs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,8 +279,11 @@ public static Command ChangeActionControlType(SerializedInputAction inputAction,
279279
{
280280
return (in InputActionsEditorState state) =>
281281
{
282-
var controlTypes = Selectors.BuildSortedControlList(inputAction.type).ToList();
283-
inputAction.wrappedProperty.FindPropertyRelative(nameof(InputAction.m_ExpectedControlType)).stringValue = controlTypes[controlTypeIndex];
282+
var controlTypes = Selectors.BuildControlTypeList(inputAction.type).ToList();
283+
284+
// ISX-1650: "Any" (in index 0) should not be put into an InputAction.expectedControlType. It's expected to be null in this case.
285+
var controlType = (controlTypeIndex == 0) ? string.Empty : controlTypes[controlTypeIndex];
286+
inputAction.wrappedProperty.FindPropertyRelative(nameof(InputAction.m_ExpectedControlType)).stringValue = controlType;
284287
state.serializedObject.ApplyModifiedProperties();
285288
return state;
286289
};

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionPropertiesView.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public ActionPropertiesView(VisualElement root, Foldout foldout, StateContainer
2525
{
2626
if (!inputAction.HasValue)
2727
return (null, new List<string>());
28-
return (inputAction.Value, Selectors.BuildSortedControlList(inputAction.Value.type).ToList());
28+
return (inputAction.Value, Selectors.BuildControlTypeList(inputAction.Value.type).ToList());
2929
});
3030
}
3131

Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/Selectors.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -161,17 +161,13 @@ public static IEnumerable<string> GetCompositePartOptions(string bindingName, st
161161
return new SerializedInputAction(actions.GetArrayElementAtIndex(state.selectedActionIndex));
162162
}
163163

164-
public static IEnumerable<string> BuildSortedControlList(InputActionType selectedActionType)
165-
{
166-
return BuildControlTypeList(selectedActionType)
167-
.OrderBy(typeName => typeName, StringComparer.OrdinalIgnoreCase);
168-
}
169-
170164
public static IEnumerable<string> BuildControlTypeList(InputActionType selectedActionType)
171165
{
172166
var allLayouts = InputSystem.s_Manager.m_Layouts;
173167

168+
// "Any" is always in first position (index 0)
174169
yield return "Any";
170+
175171
foreach (var layoutName in allLayouts.layoutTypes.Keys)
176172
{
177173
if (EditorInputControlLayoutCache.TryGetLayout(layoutName).hideInUI)

0 commit comments

Comments
 (0)