From 1b38eb193724275a3d0a035830bb8f3b4310069a Mon Sep 17 00:00:00 2001 From: JosepMariaPujol Date: Thu, 12 Feb 2026 09:39:29 +0100 Subject: [PATCH 1/4] Fixing todo, caching to reduce GC in InputControlPath --- Packages/com.unity.inputsystem/CHANGELOG.md | 1 + .../Editor/ControlPicker/InputControlPathEditor.cs | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index 8c6989670d..ead504860a 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -17,6 +17,7 @@ however, it has to be formatted properly to pass verification tests. ### Fixed +- Fixed caching for InputControlPath display name. - Fixed the `Auto-Save` toggle button with some extra pixels to align the text in the window better. - Align title font size with toolbar style in `Input Action` window. - Updated Action Properties headers to use colors consistent with GameObject component headers. diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs index cf964d13b8..fde30de733 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs @@ -123,8 +123,12 @@ public void OnGUI(Rect rect, GUIContent label = null, SerializedProperty propert return; } - ////TODO: this should be cached; generates needless GC churn - var displayName = InputControlPath.ToHumanReadableString(path); + // Cache the display name per path value and only recompute when the string actually changes. + if (!string.Equals(path, m_CachedPath, StringComparison.Ordinal)) + { + m_CachedPath = path; + m_CachedDisplayName = InputControlPath.ToHumanReadableString(path); + } // Either show dropdown control that opens path picker or show path directly as // text, if manual path editing is toggled on. @@ -209,6 +213,9 @@ private void SetExpectedControlLayoutFromAttribute(SerializedProperty property) private string m_ExpectedControlLayout; private string[] m_ControlPathsToMatch; + private string m_CachedPath; + private string m_CachedDisplayName; + private InputControlPickerDropdown m_PickerDropdown; private readonly InputControlPickerState m_PickerState; From 8086d03e302083a8fbee603c14bf5aeda7eb2b60 Mon Sep 17 00:00:00 2001 From: josepmariapujol-unity <59828124+josepmariapujol-unity@users.noreply.github.com> Date: Thu, 12 Feb 2026 11:30:56 +0100 Subject: [PATCH 2/4] Fix display name in dropdown button for control picker --- .../InputSystem/Editor/ControlPicker/InputControlPathEditor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs index fde30de733..ff073aa13f 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs @@ -150,7 +150,7 @@ public void OnGUI(Rect rect, GUIContent label = null, SerializedProperty propert else { // Dropdown that shows binding text and allows opening control picker. - if (EditorGUI.DropdownButton(bindingTextRect, new GUIContent(displayName), FocusType.Keyboard)) + if (EditorGUI.DropdownButton(bindingTextRect, new GUIContent(m_CachedDisplayName), FocusType.Keyboard)) { SetExpectedControlLayoutFromAttribute(serializedProperty); ////TODO: for bindings that are part of composites, use the layout information from the [InputControl] attribute on the field From 95d6a8a081439d5a8eeb7b49aa205aa7b21454b4 Mon Sep 17 00:00:00 2001 From: JosepMariaPujol Date: Wed, 25 Feb 2026 12:06:35 +0100 Subject: [PATCH 3/4] Update InputControlPathEditor.cs --- .../InputSystem/Editor/ControlPicker/InputControlPathEditor.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs index ff073aa13f..895fb96908 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs @@ -124,7 +124,7 @@ public void OnGUI(Rect rect, GUIContent label = null, SerializedProperty propert } // Cache the display name per path value and only recompute when the string actually changes. - if (!string.Equals(path, m_CachedPath, StringComparison.Ordinal)) + if (!string.Equals(path, m_CachedPath, StringComparison.InvariantCultureIgnoreCase)) { m_CachedPath = path; m_CachedDisplayName = InputControlPath.ToHumanReadableString(path); From f61b96f9bf6245de334fa76360cda5a05d509819 Mon Sep 17 00:00:00 2001 From: josepmariapujol-unity <59828124+josepmariapujol-unity@users.noreply.github.com> Date: Thu, 26 Feb 2026 10:03:58 +0100 Subject: [PATCH 4/4] Fix InputControlPath caching and UI alignment issues Fixed caching for InputControlPath display name and improved alignment of UI elements in the Input Action window. --- Packages/com.unity.inputsystem/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index aca187adb0..b0d94475a1 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed - Improved New Input System warning dialog, Native Device Inputs Not Enabled [UUM-132151]. +- Fixed caching for InputControlPath display name [ISX-2501](https://jira.unity3d.com/browse/ISX-2501) ### Changed @@ -26,7 +27,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. ### Fixed -- Fixed caching for InputControlPath display name. - Fixed the `Auto-Save` toggle button with some extra pixels to align the text in the window better. - Align title font size with toolbar style in `Input Action` window. - Updated Action Properties headers to use colors consistent with GameObject component headers.