From 226509a679e8b992a1e16531023b1f554cf8a039 Mon Sep 17 00:00:00 2001 From: JosepMariaPujol Date: Tue, 17 Feb 2026 10:47:36 +0100 Subject: [PATCH 1/3] Revert: CHANGE: Deprecate useIMGUIEditorForAssets #2283 --- .../CustomComposite/CustomComposite.cs | 7 ++ Assets/Tests/InputSystem/CoreTests_Actions.cs | 1 + .../Tests/InputSystem/CoreTests_Analytics.cs | 3 + .../Actions/Composites/AxisComposite.cs | 15 ++-- .../Actions/Composites/Vector2Composite.cs | 15 ++-- .../Actions/Composites/Vector3Composite.cs | 15 ++-- .../Actions/Interactions/HoldInteraction.cs | 7 +- .../Interactions/MultiTapInteraction.cs | 18 +++-- .../Actions/Interactions/PressInteraction.cs | 26 ++++-- .../Interactions/SlowTapInteraction.cs | 6 ++ .../Actions/Interactions/TapInteraction.cs | 6 ++ .../Processors/AxisDeadzoneProcessor.cs | 6 ++ .../Processors/StickDeadzoneProcessor.cs | 6 ++ .../Editor/Analytics/InputBuildAnalytic.cs | 9 +++ .../Editor/AssetEditor/ParameterListView.cs | 80 +++++++++++++++++-- .../InputActionsEditorWindow.cs | 3 + .../Views/NameAndParametersListView.cs | 2 + .../InputSystem/InputSettings.cs | 15 ++-- 18 files changed, 197 insertions(+), 43 deletions(-) diff --git a/Assets/Samples/CustomComposite/CustomComposite.cs b/Assets/Samples/CustomComposite/CustomComposite.cs index 0cbd54c3e0..273a54f4cd 100644 --- a/Assets/Samples/CustomComposite/CustomComposite.cs +++ b/Assets/Samples/CustomComposite/CustomComposite.cs @@ -136,6 +136,13 @@ public class CustomCompositeEditor : InputParameterEditor { public override void OnGUI() { + // Using the 'target' property, we can access an instance of our composite. + var currentValue = target.scaleFactor; + + // The easiest way to lay out our UI is to simply use EditorGUILayout. + // We simply assign the changed value back to the 'target' object. The input + // system will automatically detect a change in value. + target.scaleFactor = EditorGUILayout.Slider(m_ScaleFactorLabel, currentValue, 0, 2); } public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback) diff --git a/Assets/Tests/InputSystem/CoreTests_Actions.cs b/Assets/Tests/InputSystem/CoreTests_Actions.cs index 322a50a250..9ea11ae626 100644 --- a/Assets/Tests/InputSystem/CoreTests_Actions.cs +++ b/Assets/Tests/InputSystem/CoreTests_Actions.cs @@ -35,6 +35,7 @@ partial class CoreTests [TestCase(InputFeatureNames.kParanoidReadValueCachingChecks)] [TestCase(InputFeatureNames.kDisableUnityRemoteSupport)] [TestCase(InputFeatureNames.kRunPlayerUpdatesInEditMode)] + [TestCase(InputFeatureNames.kUseIMGUIEditorForAssets)] public void Settings_ShouldStoreSettingsAndFeatureFlags(string featureName) { using (var settings = Scoped.Object(InputSettings.CreateInstance())) diff --git a/Assets/Tests/InputSystem/CoreTests_Analytics.cs b/Assets/Tests/InputSystem/CoreTests_Analytics.cs index a86829a939..2a156dfb35 100644 --- a/Assets/Tests/InputSystem/CoreTests_Analytics.cs +++ b/Assets/Tests/InputSystem/CoreTests_Analytics.cs @@ -458,6 +458,7 @@ public void Analytics_ShouldReportBuildAnalytics_WhenNotHavingSettingsAsset() Assert.That(data.feature_paranoid_read_value_caching_checks_enabled, Is.EqualTo(defaultSettings.IsFeatureEnabled(InputFeatureNames.kParanoidReadValueCachingChecks))); Assert.That(data.feature_disable_unity_remote_support, Is.EqualTo(defaultSettings.IsFeatureEnabled(InputFeatureNames.kDisableUnityRemoteSupport))); Assert.That(data.feature_run_player_updates_in_editmode, Is.EqualTo(defaultSettings.IsFeatureEnabled(InputFeatureNames.kRunPlayerUpdatesInEditMode))); + Assert.That(data.feature_use_imgui_editor_for_assets, Is.EqualTo(defaultSettings.IsFeatureEnabled(InputFeatureNames.kUseIMGUIEditorForAssets))); } finally { @@ -506,6 +507,7 @@ public void Analytics_ShouldReportBuildAnalytics_WhenHavingSettingsAssetWithCust customSettings.SetInternalFeatureFlag(InputFeatureNames.kParanoidReadValueCachingChecks, true); customSettings.SetInternalFeatureFlag(InputFeatureNames.kDisableUnityRemoteSupport, true); customSettings.SetInternalFeatureFlag(InputFeatureNames.kRunPlayerUpdatesInEditMode, true); + customSettings.SetInternalFeatureFlag(InputFeatureNames.kUseIMGUIEditorForAssets, true); customSettings.SetInternalFeatureFlag(InputFeatureNames.kUseReadValueCaching, true); InputSystem.settings = customSettings; @@ -552,6 +554,7 @@ public void Analytics_ShouldReportBuildAnalytics_WhenHavingSettingsAssetWithCust Assert.That(data.feature_paranoid_read_value_caching_checks_enabled, Is.True); Assert.That(data.feature_disable_unity_remote_support, Is.True); Assert.That(data.feature_run_player_updates_in_editmode, Is.True); + Assert.That(data.feature_use_imgui_editor_for_assets, Is.True); } finally { diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/AxisComposite.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/AxisComposite.cs index 297ecb0c36..da72a70b8a 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/AxisComposite.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/AxisComposite.cs @@ -5,6 +5,7 @@ #if UNITY_EDITOR using System; +using UnityEditor; using UnityEngine.InputSystem.Editor; using UnityEngine.UIElements; #endif @@ -211,20 +212,24 @@ public enum WhichSideWins #if UNITY_EDITOR internal class AxisCompositeEditor : InputParameterEditor { - private const string label = "Which Side Wins"; - private const string tooltipText = "Determine which axis 'wins' if both are actuated at the same time. " + private GUIContent m_WhichAxisWinsLabel = new GUIContent("Which Side Wins", + "Determine which axis 'wins' if both are actuated at the same time. " + "If 'Neither' is selected, the result is 0 (or, more precisely, " - + "the midpoint between minValue and maxValue)."; + + "the midpoint between minValue and maxValue)."); public override void OnGUI() { + if (!InputSystem.settings.useIMGUIEditorForAssets) + return; + + target.whichSideWins = (AxisComposite.WhichSideWins)EditorGUILayout.EnumPopup(m_WhichAxisWinsLabel, target.whichSideWins); } public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback) { - var modeField = new EnumField(label, target.whichSideWins) + var modeField = new EnumField(m_WhichAxisWinsLabel.text, target.whichSideWins) { - tooltip = tooltipText + tooltip = m_WhichAxisWinsLabel.tooltip }; modeField.RegisterValueChangedCallback(evt => diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector2Composite.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector2Composite.cs index a8568f8013..730588db0c 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector2Composite.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector2Composite.cs @@ -5,6 +5,7 @@ using UnityEngine.InputSystem.Utilities; #if UNITY_EDITOR +using UnityEditor; using UnityEngine.InputSystem.Editor; using UnityEngine.UIElements; #endif @@ -191,20 +192,24 @@ public enum Mode #if UNITY_EDITOR internal class Vector2CompositeEditor : InputParameterEditor { - private const string label = "Mode"; - private const string tooltipText = "How to synthesize a Vector2 from the inputs. Digital " + private GUIContent m_ModeLabel = new GUIContent("Mode", + "How to synthesize a Vector2 from the inputs. Digital " + "treats part bindings as buttons (on/off) whereas Analog preserves " - + "floating-point magnitudes as read from controls."; + + "floating-point magnitudes as read from controls."); public override void OnGUI() { + if (!InputSystem.settings.useIMGUIEditorForAssets) + return; + + target.mode = (Vector2Composite.Mode)EditorGUILayout.EnumPopup(m_ModeLabel, target.mode); } public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback) { - var modeField = new EnumField(label, target.mode) + var modeField = new EnumField(m_ModeLabel.text, target.mode) { - tooltip = tooltipText + tooltip = m_ModeLabel.tooltip }; modeField.RegisterValueChangedCallback(evt => diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector3Composite.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector3Composite.cs index 72371f81b3..21383c700b 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector3Composite.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector3Composite.cs @@ -4,6 +4,7 @@ using UnityEngine.InputSystem.Utilities; #if UNITY_EDITOR +using UnityEditor; using UnityEngine.InputSystem.Editor; using UnityEngine.UIElements; #endif @@ -171,20 +172,24 @@ public enum Mode #if UNITY_EDITOR internal class Vector3CompositeEditor : InputParameterEditor { - private const string label = "Mode"; - private const string tooltip = "How to synthesize a Vector3 from the inputs. Digital " + private GUIContent m_ModeLabel = new GUIContent("Mode", + "How to synthesize a Vector3 from the inputs. Digital " + "treats part bindings as buttons (on/off) whereas Analog preserves " - + "floating-point magnitudes as read from controls."; + + "floating-point magnitudes as read from controls."); public override void OnGUI() { + if (!InputSystem.settings.useIMGUIEditorForAssets) + return; + + target.mode = (Vector3Composite.Mode)EditorGUILayout.EnumPopup(m_ModeLabel, target.mode); } public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback) { - var modeField = new EnumField(label, target.mode) + var modeField = new EnumField(m_ModeLabel.text, target.mode) { - tooltip = tooltip + tooltip = m_ModeLabel.tooltip }; modeField.RegisterValueChangedCallback(evt => diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/HoldInteraction.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/HoldInteraction.cs index 45f08e261f..9345d5f9b0 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/HoldInteraction.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/HoldInteraction.cs @@ -1,7 +1,7 @@ using System; using System.ComponentModel; using UnityEngine.InputSystem.Controls; - +using UnityEngine.Scripting; #if UNITY_EDITOR using UnityEngine.InputSystem.Editor; using UnityEngine.UIElements; @@ -124,6 +124,11 @@ protected override void OnEnable() public override void OnGUI() { + if (!InputSystem.settings.useIMGUIEditorForAssets) + return; + + m_PressPointSetting.OnGUI(); + m_DurationSetting.OnGUI(); } public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback) diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/MultiTapInteraction.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/MultiTapInteraction.cs index d068639dae..41610ced29 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/MultiTapInteraction.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/MultiTapInteraction.cs @@ -1,9 +1,11 @@ using System; using UnityEngine.InputSystem.Controls; - +using UnityEngine.Scripting; #if UNITY_EDITOR +using UnityEditor; using UnityEngine.InputSystem.Editor; using UnityEngine.UIElements; +using UnityEditor.UIElements; #endif ////TODO: add ability to respond to any of the taps in the sequence (e.g. one response for single tap, another for double tap) @@ -194,14 +196,21 @@ protected override void OnEnable() public override void OnGUI() { + if (!InputSystem.settings.useIMGUIEditorForAssets) + return; + + target.tapCount = EditorGUILayout.IntField(m_TapCountLabel, target.tapCount); + m_TapDelaySetting.OnGUI(); + m_TapTimeSetting.OnGUI(); + m_PressPointSetting.OnGUI(); } public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback) { - var tapCountField = new IntegerField(tapLabel) + var tapCountField = new IntegerField(m_TapCountLabel.text) { value = target.tapCount, - tooltip = tapTooltip + tooltip = m_TapCountLabel.tooltip }; tapCountField.RegisterValueChangedCallback(evt => { @@ -215,8 +224,7 @@ public override void OnDrawVisualElements(VisualElement root, Action onChangedCa m_PressPointSetting.OnDrawVisualElements(root, onChangedCallback); } - private const string tapLabel = "Tap Count"; - private const string tapTooltip = "How many taps need to be performed in succession. Two means double-tap, three means triple-tap, and so on."; + private readonly GUIContent m_TapCountLabel = new GUIContent("Tap Count", "How many taps need to be performed in succession. Two means double-tap, three means triple-tap, and so on."); private CustomOrDefaultSetting m_PressPointSetting; private CustomOrDefaultSetting m_TapTimeSetting; diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/PressInteraction.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/PressInteraction.cs index 3b7c7a20b0..f5361ae56b 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/PressInteraction.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/PressInteraction.cs @@ -1,9 +1,12 @@ using System; using System.ComponentModel; using UnityEngine.InputSystem.Controls; +using UnityEngine.Scripting; #if UNITY_EDITOR +using UnityEditor; using UnityEngine.InputSystem.Editor; using UnityEngine.UIElements; +using UnityEditor.UIElements; #endif ////TODO: protect against the control *hovering* around the press point; this should not fire the press repeatedly; probably need a zone around the press point @@ -210,15 +213,21 @@ protected override void OnEnable() public override void OnGUI() { + if (!InputSystem.settings.useIMGUIEditorForAssets) + return; + + EditorGUILayout.HelpBox(s_HelpBoxText); + target.behavior = (PressBehavior)EditorGUILayout.EnumPopup(s_PressBehaviorLabel, target.behavior); + m_PressPointSetting.OnGUI(); } public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback) { - root.Add(new HelpBox(helpLabel, HelpBoxMessageType.None)); + root.Add(new HelpBox(s_HelpBoxText.text, HelpBoxMessageType.None)); - var behaviourDropdown = new EnumField(triggerLabel, target.behavior) + var behaviourDropdown = new EnumField(s_PressBehaviorLabel.text, target.behavior) { - tooltip = triggerTooltip + tooltip = s_PressBehaviorLabel.tooltip }; behaviourDropdown.RegisterValueChangedCallback(evt => { @@ -232,13 +241,14 @@ public override void OnDrawVisualElements(VisualElement root, Action onChangedCa private CustomOrDefaultSetting m_PressPointSetting; - private const string helpLabel = "Note that the 'Press' interaction is only " + private static readonly GUIContent s_HelpBoxText = EditorGUIUtility.TrTextContent("Note that the 'Press' interaction is only " + "necessary when wanting to customize button press behavior. For default press behavior, simply set the action type to 'Button' " - + "and use the action without interactions added to it."; - private const string triggerLabel = "Trigger Behavior"; - private const string triggerTooltip = "Determines how button presses trigger the action. By default (PressOnly), the action is performed on press. " + + "and use the action without interactions added to it."); + + private static readonly GUIContent s_PressBehaviorLabel = EditorGUIUtility.TrTextContent("Trigger Behavior", + "Determines how button presses trigger the action. By default (PressOnly), the action is performed on press. " + "With ReleaseOnly, the action is performed on release. With PressAndRelease, the action is performed on press and " - + "canceled on release."; + + "canceled on release."); } #endif } diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/SlowTapInteraction.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/SlowTapInteraction.cs index 6d663989b5..cb79393e00 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/SlowTapInteraction.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/SlowTapInteraction.cs @@ -1,6 +1,7 @@ using System; using System.ComponentModel; using UnityEngine.InputSystem.Controls; +using UnityEngine.Scripting; #if UNITY_EDITOR using UnityEngine.InputSystem.Editor; using UnityEngine.UIElements; @@ -87,6 +88,11 @@ protected override void OnEnable() public override void OnGUI() { + if (!InputSystem.settings.useIMGUIEditorForAssets) + return; + + m_DurationSetting.OnGUI(); + m_PressPointSetting.OnGUI(); } public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback) diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/TapInteraction.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/TapInteraction.cs index 9fea108006..cd3fe54b95 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/TapInteraction.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/TapInteraction.cs @@ -1,6 +1,7 @@ using System; using System.ComponentModel; using UnityEngine.InputSystem.Controls; +using UnityEngine.Scripting; #if UNITY_EDITOR using UnityEngine.InputSystem.Editor; using UnityEngine.UIElements; @@ -113,6 +114,11 @@ protected override void OnEnable() public override void OnGUI() { + if (!InputSystem.settings.useIMGUIEditorForAssets) + return; + + m_DurationSetting.OnGUI(); + m_PressPointSetting.OnGUI(); } public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback) diff --git a/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/AxisDeadzoneProcessor.cs b/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/AxisDeadzoneProcessor.cs index 066eb2aaf4..f86bb17c18 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/AxisDeadzoneProcessor.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/AxisDeadzoneProcessor.cs @@ -1,4 +1,5 @@ using System; +using UnityEngine.Scripting; #if UNITY_EDITOR using UnityEngine.InputSystem.Editor; @@ -92,6 +93,11 @@ protected override void OnEnable() public override void OnGUI() { + if (!InputSystem.settings.useIMGUIEditorForAssets) + return; + + m_MinSetting.OnGUI(); + m_MaxSetting.OnGUI(); } public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback) diff --git a/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/StickDeadzoneProcessor.cs b/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/StickDeadzoneProcessor.cs index 1dec047010..631f7b51d5 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/StickDeadzoneProcessor.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/StickDeadzoneProcessor.cs @@ -1,4 +1,5 @@ using System; +using UnityEngine.Scripting; #if UNITY_EDITOR using UnityEngine.InputSystem.Editor; @@ -81,6 +82,11 @@ protected override void OnEnable() public override void OnGUI() { + if (!InputSystem.settings.useIMGUIEditorForAssets) + return; + + m_MinSetting.OnGUI(); + m_MaxSetting.OnGUI(); } public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback) diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/Analytics/InputBuildAnalytic.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/Analytics/InputBuildAnalytic.cs index dd719aa8f3..ee986c9e16 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/Analytics/InputBuildAnalytic.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/Analytics/InputBuildAnalytic.cs @@ -195,6 +195,9 @@ public InputBuildAnalyticData(BuildReport report, InputSettings settings, InputS feature_paranoid_read_value_caching_checks_enabled = settings.IsFeatureEnabled(InputFeatureNames.kParanoidReadValueCachingChecks); + feature_use_imgui_editor_for_assets = + settings.IsFeatureEnabled(InputFeatureNames.kUseIMGUIEditorForAssets); + feature_disable_unity_remote_support = settings.IsFeatureEnabled(InputFeatureNames.kDisableUnityRemoteSupport); feature_run_player_updates_in_editmode = @@ -327,6 +330,12 @@ public InputBuildAnalyticData(BuildReport report, InputSettings settings, InputS /// public bool feature_paranoid_read_value_caching_checks_enabled; + /// + /// Represents internal feature flag + /// as defined in InputSystem 1.8.x. + /// + public bool feature_use_imgui_editor_for_assets; + /// /// Represents internal feature flag /// as defined in InputSystem 1.8.x. diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/ParameterListView.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/ParameterListView.cs index 9b38064796..25bd44764c 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/ParameterListView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/ParameterListView.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Reflection; using UnityEditor; +using UnityEditor.UIElements; using UnityEngine.InputSystem.Layouts; using UnityEngine.InputSystem.Utilities; using UnityEngine.UIElements; @@ -134,7 +135,7 @@ public void Initialize(Type registeredType, ReadOnlyArray existingPa parameter.value = parameter.value.ConvertTo(underlyingTypeCode); // Read enum names and values. - parameter.enumNames = Enum.GetNames(fieldType); + parameter.enumNames = Enum.GetNames(fieldType).Select(x => new GUIContent(x)).ToArray(); ////REVIEW: this probably falls apart if multiple members have the same value var list = new List(); foreach (var value in Enum.GetValues(fieldType)) @@ -223,7 +224,7 @@ public void Initialize(Type registeredType, ReadOnlyArray existingPa m_ParameterEditor = null; // Create parameter labels. - m_ParameterLabels = new(string text, string tooltip)[m_Parameters.Length]; + m_ParameterLabels = new GUIContent[m_Parameters.Length]; for (var i = 0; i < m_Parameters.Length; ++i) { // Look up tooltip from field. @@ -235,7 +236,7 @@ public void Initialize(Type registeredType, ReadOnlyArray existingPa // Create label. var niceName = ObjectNames.NicifyVariableName(m_Parameters[i].value.name); - m_ParameterLabels[i] = (niceName, tooltip); + m_ParameterLabels[i] = new GUIContent(niceName, tooltip); } } } @@ -276,7 +277,7 @@ void OnEditEnd() if (parameter.isEnum) { - var names = parameter.enumNames.ToList(); + var names = parameter.enumNames.Select(c => c.text).ToList(); var rawValue = parameter.value.value.ToInt32(); var selectedIndex = parameter.enumValues.IndexOf(rawValue); if (selectedIndex < 0 || selectedIndex >= names.Count) @@ -349,6 +350,72 @@ private void OnValuesChanged() public void OnGUI() { + // If we have a dedicated parameter editor, let it do all the work. + if (m_ParameterEditor != null) + { + EditorGUI.BeginChangeCheck(); + m_ParameterEditor.OnGUI(); + if (EditorGUI.EndChangeCheck()) + { + ReadParameterValuesFrom(m_ParameterEditor.target); + onChange?.Invoke(); + } + return; + } + + // handled by OnDrawVisualElements with UI Toolkit + if (!InputSystem.settings.useIMGUIEditorForAssets) + return; + + // Otherwise, fall back to our default logic. + if (m_Parameters == null) + return; + for (var i = 0; i < m_Parameters.Length; i++) + { + var parameter = m_Parameters[i]; + var label = m_ParameterLabels[i]; + + EditorGUI.BeginChangeCheck(); + + object result = null; + if (parameter.isEnum) + { + var intValue = parameter.value.value.ToInt32(); + result = EditorGUILayout.IntPopup(label, intValue, parameter.enumNames, parameter.enumValues); + } + else if (parameter.value.type == TypeCode.Int64 || parameter.value.type == TypeCode.UInt64) + { + var longValue = parameter.value.value.ToInt64(); + result = EditorGUILayout.LongField(label, longValue); + } + else if (parameter.value.type.IsInt()) + { + var intValue = parameter.value.value.ToInt32(); + result = EditorGUILayout.IntField(label, intValue); + } + else if (parameter.value.type == TypeCode.Single) + { + var floatValue = parameter.value.value.ToSingle(); + result = EditorGUILayout.FloatField(label, floatValue); + } + else if (parameter.value.type == TypeCode.Double) + { + var floatValue = parameter.value.value.ToDouble(); + result = EditorGUILayout.DoubleField(label, floatValue); + } + else if (parameter.value.type == TypeCode.Boolean) + { + var boolValue = parameter.value.value.ToBoolean(); + result = EditorGUILayout.Toggle(label, boolValue); + } + + if (EditorGUI.EndChangeCheck()) + { + parameter.value.value = PrimitiveValue.FromObject(result).ConvertTo(parameter.value.type); + m_Parameters[i] = parameter; + onChange?.Invoke(); + } + } } ////REVIEW: check whether parameters have *actually* changed? @@ -381,15 +448,14 @@ private void ReadParameterValuesFrom(object target) private InputParameterEditor m_ParameterEditor; private EditableParameterValue[] m_Parameters; - - private (string text, string tooltip)[] m_ParameterLabels; + private GUIContent[] m_ParameterLabels; private struct EditableParameterValue { public NamedValue value; public NamedValue? defaultValue; public int[] enumValues; - public string[] enumNames; + public GUIContent[] enumNames; public FieldInfo field; public bool isEnum => enumValues != null; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs index 41e890533a..9a6ec57263 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs @@ -58,6 +58,9 @@ public static bool OpenAsset(int instanceId, int line) private static bool OpenAsset(Object obj) { + if (InputSystem.settings.IsFeatureEnabled(InputFeatureNames.kUseIMGUIEditorForAssets)) + return false; + // Grab InputActionAsset. // NOTE: We defer checking out an asset until we save it. This allows a user to open an .inputactions asset and look at it // without forcing a checkout. diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/NameAndParametersListView.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/NameAndParametersListView.cs index 5c58afb174..c0f0bade83 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/NameAndParametersListView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/NameAndParametersListView.cs @@ -171,6 +171,8 @@ public NameAndParametersListViewItem(VisualElement root, ParameterListView param var foldout = container.Q("Foldout"); foldout.text = parameterListView.name; parameterListView.OnDrawVisualElements(foldout); + + foldout.Add(new IMGUIContainer(parameterListView.OnGUI)); } } } diff --git a/Packages/com.unity.inputsystem/InputSystem/InputSettings.cs b/Packages/com.unity.inputsystem/InputSystem/InputSettings.cs index 03a81d2150..4ebbe2bc07 100644 --- a/Packages/com.unity.inputsystem/InputSystem/InputSettings.cs +++ b/Packages/com.unity.inputsystem/InputSystem/InputSettings.cs @@ -719,11 +719,6 @@ public void SetInternalFeatureFlag(string featureName, bool enabled) if (string.IsNullOrEmpty(featureName)) throw new ArgumentNullException(nameof(featureName)); - if (featureName == InputFeatureNames.kUseIMGUIEditorForAssets) - { - throw new ArgumentException($"The {InputFeatureNames.kUseIMGUIEditorForAssets} feature flag is no longer supported."); - } - if (m_FeatureFlags == null) m_FeatureFlags = new HashSet(); @@ -964,8 +959,14 @@ public enum InputActionPropertyDrawerMode } #if UNITY_EDITOR - [Obsolete("useIMGUIEditorForAssets is obsolete and will be removed in a future release.")] - public bool useIMGUIEditorForAssets => false; + /// + /// Determines if we should render the UI with IMGUI even if an UI Toolkit UI is available. + /// + /// This should be used when writing a custom to : + /// * support inspector view which only work in IMGUI for now. + /// * prevent the UI to be rendered in IMGUI and UI Toolkit in the Input Actions Editor window. + /// + public bool useIMGUIEditorForAssets => UnityEditor.EditorGUI.indentLevel > 0 || IsFeatureEnabled(InputFeatureNames.kUseIMGUIEditorForAssets); #endif private static bool CompareFloats(float a, float b) From 20e7e73bf789c51d5fc464e5cfe07751e1f97ee2 Mon Sep 17 00:00:00 2001 From: JosepMariaPujol Date: Tue, 17 Feb 2026 13:17:07 +0100 Subject: [PATCH 2/3] Original CoreTests and InputBuildAnalytic --- Assets/Tests/InputSystem/CoreTests_Actions.cs | 1 - Assets/Tests/InputSystem/CoreTests_Analytics.cs | 3 --- .../Editor/Analytics/InputBuildAnalytic.cs | 11 +---------- 3 files changed, 1 insertion(+), 14 deletions(-) diff --git a/Assets/Tests/InputSystem/CoreTests_Actions.cs b/Assets/Tests/InputSystem/CoreTests_Actions.cs index 9ea11ae626..322a50a250 100644 --- a/Assets/Tests/InputSystem/CoreTests_Actions.cs +++ b/Assets/Tests/InputSystem/CoreTests_Actions.cs @@ -35,7 +35,6 @@ partial class CoreTests [TestCase(InputFeatureNames.kParanoidReadValueCachingChecks)] [TestCase(InputFeatureNames.kDisableUnityRemoteSupport)] [TestCase(InputFeatureNames.kRunPlayerUpdatesInEditMode)] - [TestCase(InputFeatureNames.kUseIMGUIEditorForAssets)] public void Settings_ShouldStoreSettingsAndFeatureFlags(string featureName) { using (var settings = Scoped.Object(InputSettings.CreateInstance())) diff --git a/Assets/Tests/InputSystem/CoreTests_Analytics.cs b/Assets/Tests/InputSystem/CoreTests_Analytics.cs index 2a156dfb35..a86829a939 100644 --- a/Assets/Tests/InputSystem/CoreTests_Analytics.cs +++ b/Assets/Tests/InputSystem/CoreTests_Analytics.cs @@ -458,7 +458,6 @@ public void Analytics_ShouldReportBuildAnalytics_WhenNotHavingSettingsAsset() Assert.That(data.feature_paranoid_read_value_caching_checks_enabled, Is.EqualTo(defaultSettings.IsFeatureEnabled(InputFeatureNames.kParanoidReadValueCachingChecks))); Assert.That(data.feature_disable_unity_remote_support, Is.EqualTo(defaultSettings.IsFeatureEnabled(InputFeatureNames.kDisableUnityRemoteSupport))); Assert.That(data.feature_run_player_updates_in_editmode, Is.EqualTo(defaultSettings.IsFeatureEnabled(InputFeatureNames.kRunPlayerUpdatesInEditMode))); - Assert.That(data.feature_use_imgui_editor_for_assets, Is.EqualTo(defaultSettings.IsFeatureEnabled(InputFeatureNames.kUseIMGUIEditorForAssets))); } finally { @@ -507,7 +506,6 @@ public void Analytics_ShouldReportBuildAnalytics_WhenHavingSettingsAssetWithCust customSettings.SetInternalFeatureFlag(InputFeatureNames.kParanoidReadValueCachingChecks, true); customSettings.SetInternalFeatureFlag(InputFeatureNames.kDisableUnityRemoteSupport, true); customSettings.SetInternalFeatureFlag(InputFeatureNames.kRunPlayerUpdatesInEditMode, true); - customSettings.SetInternalFeatureFlag(InputFeatureNames.kUseIMGUIEditorForAssets, true); customSettings.SetInternalFeatureFlag(InputFeatureNames.kUseReadValueCaching, true); InputSystem.settings = customSettings; @@ -554,7 +552,6 @@ public void Analytics_ShouldReportBuildAnalytics_WhenHavingSettingsAssetWithCust Assert.That(data.feature_paranoid_read_value_caching_checks_enabled, Is.True); Assert.That(data.feature_disable_unity_remote_support, Is.True); Assert.That(data.feature_run_player_updates_in_editmode, Is.True); - Assert.That(data.feature_use_imgui_editor_for_assets, Is.True); } finally { diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/Analytics/InputBuildAnalytic.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/Analytics/InputBuildAnalytic.cs index ee986c9e16..78666fd1dd 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/Analytics/InputBuildAnalytic.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/Analytics/InputBuildAnalytic.cs @@ -195,9 +195,6 @@ public InputBuildAnalyticData(BuildReport report, InputSettings settings, InputS feature_paranoid_read_value_caching_checks_enabled = settings.IsFeatureEnabled(InputFeatureNames.kParanoidReadValueCachingChecks); - feature_use_imgui_editor_for_assets = - settings.IsFeatureEnabled(InputFeatureNames.kUseIMGUIEditorForAssets); - feature_disable_unity_remote_support = settings.IsFeatureEnabled(InputFeatureNames.kDisableUnityRemoteSupport); feature_run_player_updates_in_editmode = @@ -330,12 +327,6 @@ public InputBuildAnalyticData(BuildReport report, InputSettings settings, InputS /// public bool feature_paranoid_read_value_caching_checks_enabled; - /// - /// Represents internal feature flag - /// as defined in InputSystem 1.8.x. - /// - public bool feature_use_imgui_editor_for_assets; - /// /// Represents internal feature flag /// as defined in InputSystem 1.8.x. @@ -390,4 +381,4 @@ public void OnPostprocessBuild(BuildReport report) } } } -#endif +#endif \ No newline at end of file From ec22b5637ffba53a1e4604bd8d38b911eb494e9c Mon Sep 17 00:00:00 2001 From: JosepMariaPujol Date: Tue, 17 Feb 2026 15:56:14 +0100 Subject: [PATCH 3/3] Fixing InputParameterEditor --- .../Editor/InputParameterEditor.cs | 50 ++----------------- 1 file changed, 3 insertions(+), 47 deletions(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/InputParameterEditor.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/InputParameterEditor.cs index 6313b4343c..c2b8d0dc1c 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/InputParameterEditor.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/InputParameterEditor.cs @@ -210,19 +210,12 @@ public void Initialize(string label, string tooltip, string defaultName, Func> Project Settings... >> Input (NEW)." - : "If enabled, the default value is used."); + m_ToggleLabel = EditorGUIUtility.TrTextContent( + "Default", $"If enabled, the default {label.ToLowerInvariant()} configured globally in the input settings is used. See Edit >> Project Settings... >> Input (NEW)."); m_ValueLabel = EditorGUIUtility.TrTextContent(label, tooltip); - if (defaultComesFromInputSettings) - m_OpenInputSettingsLabel = EditorGUIUtility.TrTextContent("Open Input Settings"); m_DefaultInitializedValue = defaultInitializedValue; m_UseDefaultValue = Mathf.Approximately(getValue(), defaultInitializedValue); m_DefaultComesFromInputSettings = defaultComesFromInputSettings; - m_HelpBoxText = - EditorGUIUtility.TrTextContent( - $"Uses \"{defaultName}\" set in project-wide input settings."); } public void OnDrawVisualElements(VisualElement root, Action onChangedCallback) @@ -249,12 +242,10 @@ public void OnDrawVisualElements(VisualElement root, Action onChangedCallback) m_FloatField.RegisterValueChangedCallback(ChangeSettingValue); m_FloatField.RegisterCallback(_ => OnEditEnd(onChangedCallback)); m_FloatField.SetEnabled(!m_UseDefaultValue); - - m_HelpBox = new HelpBox(m_HelpBoxText.text, HelpBoxMessageType.None); - m_DefaultToggle = new Toggle("Default") { value = m_UseDefaultValue, + tooltip = m_ToggleLabel.tooltip, style = { flexDirection = FlexDirection.RowReverse @@ -263,28 +254,10 @@ public void OnDrawVisualElements(VisualElement root, Action onChangedCallback) m_DefaultToggle.RegisterValueChangedCallback(evt => ToggleUseDefaultValue(evt, onChangedCallback)); m_DefaultToggle.Q