Skip to content

FIX: UITK Listen button not working with Any control types #1788

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

Merged
merged 4 commits into from
Nov 2, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
7 changes: 4 additions & 3 deletions Packages/com.unity.inputsystem/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,11 @@ however, it has to be formatted properly to pass verification tests.
- 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.
- Fixed an issue where undoing deletion of Action Maps did not restore Actions correctly.
- 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.
- 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.
- 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).
- Fixed [ISX-1661](https://jira.unity3d.com/browse/ISX-1661) where undoing duplications of action maps caused console errors
- Fixed issue where the expanded/collapsed state of items in the input action editor was not properly saved between rebuilds of the UI.
- 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).
- Fixed an issue where undoing duplications of action maps caused console errors.
- Fix for BindingSyntax `WithInteraction()` which was incorrectly using processors.
- Fix for UITK Input Action Editor binding 'Listen' button which wasn't working in the case for Control Type 'Any'.
- Fixed issue of visual elements being null during editing project-wide actions in project settings which prompted console errors.


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,8 +279,11 @@ public static Command ChangeActionControlType(SerializedInputAction inputAction,
{
return (in InputActionsEditorState state) =>
{
var controlTypes = Selectors.BuildSortedControlList(inputAction.type).ToList();
inputAction.wrappedProperty.FindPropertyRelative(nameof(InputAction.m_ExpectedControlType)).stringValue = controlTypes[controlTypeIndex];
var controlTypes = Selectors.BuildControlTypeList(inputAction.type).ToList();

// ISX-1650: "Any" (in index 0) should not be put into an InputAction.expectedControlType. It's expected to be null in this case.
var controlType = (controlTypeIndex == 0) ? string.Empty : controlTypes[controlTypeIndex];
inputAction.wrappedProperty.FindPropertyRelative(nameof(InputAction.m_ExpectedControlType)).stringValue = controlType;
state.serializedObject.ApplyModifiedProperties();
return state;
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public ActionPropertiesView(VisualElement root, Foldout foldout, StateContainer
{
if (!inputAction.HasValue)
return (null, new List<string>());
return (inputAction.Value, Selectors.BuildSortedControlList(inputAction.Value.type).ToList());
return (inputAction.Value, Selectors.BuildControlTypeList(inputAction.Value.type).ToList());
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,17 +161,13 @@ public static IEnumerable<string> GetCompositePartOptions(string bindingName, st
return new SerializedInputAction(actions.GetArrayElementAtIndex(state.selectedActionIndex));
}

public static IEnumerable<string> BuildSortedControlList(InputActionType selectedActionType)
{
return BuildControlTypeList(selectedActionType)
.OrderBy(typeName => typeName, StringComparer.OrdinalIgnoreCase);
}

public static IEnumerable<string> BuildControlTypeList(InputActionType selectedActionType)
{
var allLayouts = InputSystem.s_Manager.m_Layouts;

// "Any" is always in first position (index 0)
yield return "Any";

foreach (var layoutName in allLayouts.layoutTypes.Keys)
{
if (EditorInputControlLayoutCache.TryGetLayout(layoutName).hideInUI)
Expand Down