From b2cef08fa22eb054d80ed18a045ca23345e0afc8 Mon Sep 17 00:00:00 2001 From: JosepMariaPujol Date: Mon, 28 Sep 2026 09:45:33 +0200 Subject: [PATCH 1/2] Backport unity repo changes --- .../ControlPicker/InputControlPathEditor.cs | 5 ++++- .../InputActionsEditorConstants.cs | 5 +++++ .../InputActionsEditorStyles.uss | 5 +++++ .../Views/ActionPropertiesView.cs | 19 ++++--------------- .../Views/BindingPropertiesView.cs | 1 + .../CompositePartBindingPropertiesView.cs | 2 ++ 6 files changed, 21 insertions(+), 16 deletions(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs index 895fb96908..989dbffd73 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs @@ -78,6 +78,9 @@ public void SetExpectedControlLayoutFromAttribute() SetExpectedControlLayout(attribute.layout); } + // Fixed label width in pixels; zero sizes the label to its text. + internal float labelWidth { get; set; } + public void OnGUI() { EditorGUILayout.BeginHorizontal(); @@ -96,7 +99,7 @@ public void OnGUI(Rect rect, GUIContent label = null, SerializedProperty propert var lineRect = rect; var labelRect = lineRect; - labelRect.width = EditorStyles.label.CalcSize(pathLabel).x + 20; // Fit to label with some padding + labelRect.width = labelWidth > 0 ? labelWidth : EditorStyles.label.CalcSize(pathLabel).x + 20; EditorGUI.LabelField(labelRect, pathLabel); lineRect.x += labelRect.width; lineRect.width -= labelRect.width; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorConstants.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorConstants.cs index 1d25d69635..db8dfe3f95 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorConstants.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorConstants.cs @@ -21,6 +21,11 @@ internal static class InputActionsEditorConstants /// Classes public static readonly string HiddenStyleClassName = "unity-input-actions-editor-hidden"; + public static readonly string PropertiesFieldStyleClassName = "properties-field"; + + // Must stay in sync with the .properties-field label width in InputActionsEditorStyles.uss. + // Only the IMGUI control path editor needs it as a number; UITK fields get it from USS. + public const int PropertiesLabelWidth = 120; public const string CompositePartAssignmentTooltip = "The named part of the composite that the binding is assigned to. Multiple bindings may be assigned the same part. All controls from " diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/PackageResources/InputActionsEditorStyles.uss b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/PackageResources/InputActionsEditorStyles.uss index cee4211595..d88ede9e7d 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/PackageResources/InputActionsEditorStyles.uss +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/PackageResources/InputActionsEditorStyles.uss @@ -237,3 +237,8 @@ #control-schemes-toolbar-container { flex-shrink: 0; } + +.properties-field > .unity-base-field__label { + min-width: 120px; + width: 120px; +} diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionPropertiesView.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionPropertiesView.cs index 45ab346662..bfe2eb0288 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionPropertiesView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionPropertiesView.cs @@ -11,7 +11,6 @@ namespace UnityEngine.InputSystem.Editor internal class ActionPropertiesView : ViewBase<(SerializedInputAction?, List)> { private readonly Foldout m_ParentFoldout; - private readonly int m_DropdownLabelWidth = 90; public ActionPropertiesView(VisualElement root, Foldout foldout, StateContainer stateContainer) : base(root, stateContainer) @@ -43,11 +42,7 @@ public override void RedrawUI((SerializedInputAction ? , List) viewState tooltip = inputAction.actionTypeTooltip }; - // Tighten up the gap between the label and dropdown so the latter is more readable when the parent pane is at min width. - var actionLabel = actionType.Q