diff --git a/Assets/Samples/CustomComposite/CustomComposite.cs b/Assets/Samples/CustomComposite/CustomComposite.cs index 273a54f4cd..0cbd54c3e0 100644 --- a/Assets/Samples/CustomComposite/CustomComposite.cs +++ b/Assets/Samples/CustomComposite/CustomComposite.cs @@ -136,13 +136,6 @@ 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 abf240d098..adf5f74c45 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/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index 21cddde19e..8460dc8fb8 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -11,9 +11,10 @@ however, it has to be formatted properly to pass verification tests. ## [Unreleased] - yyyy-mm-dd ### Changed -- Project-Wide Input Actions support can no longer be disabled (removed the UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS define). (ISX-2397) +- Project-Wide Input Actions support can no longer be compiled out (removed the `UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS` define). (ISX-2397) - Removed code that had to do with Unity versions older than Unity 2022.3 LTS. (ISX-2396) - Auto-save on focus lost can no longer be compiled out (ISX-2397) +- Deprecated the `USE_IMGUI_EDITOR_FOR_ASSETS` feature option (ISX-2397) ### Fixed - An issue where a UITK MouseEvent was triggered when changing from Scene View to Game View in the Editor has been fixed. [ISXB-1671](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1671) diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/AxisComposite.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/AxisComposite.cs index da72a70b8a..297ecb0c36 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/AxisComposite.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/AxisComposite.cs @@ -5,7 +5,6 @@ #if UNITY_EDITOR using System; -using UnityEditor; using UnityEngine.InputSystem.Editor; using UnityEngine.UIElements; #endif @@ -212,24 +211,20 @@ public enum WhichSideWins #if UNITY_EDITOR internal class AxisCompositeEditor : InputParameterEditor { - private GUIContent m_WhichAxisWinsLabel = new GUIContent("Which Side Wins", - "Determine which axis 'wins' if both are actuated at the same time. " + private const string label = "Which Side Wins"; + private const string tooltipText = "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(m_WhichAxisWinsLabel.text, target.whichSideWins) + var modeField = new EnumField(label, target.whichSideWins) { - tooltip = m_WhichAxisWinsLabel.tooltip + tooltip = tooltipText }; 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 730588db0c..a8568f8013 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector2Composite.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector2Composite.cs @@ -5,7 +5,6 @@ using UnityEngine.InputSystem.Utilities; #if UNITY_EDITOR -using UnityEditor; using UnityEngine.InputSystem.Editor; using UnityEngine.UIElements; #endif @@ -192,24 +191,20 @@ public enum Mode #if UNITY_EDITOR internal class Vector2CompositeEditor : InputParameterEditor { - private GUIContent m_ModeLabel = new GUIContent("Mode", - "How to synthesize a Vector2 from the inputs. Digital " + private const string label = "Mode"; + private const string tooltipText = "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(m_ModeLabel.text, target.mode) + var modeField = new EnumField(label, target.mode) { - tooltip = m_ModeLabel.tooltip + tooltip = tooltipText }; 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 21383c700b..72371f81b3 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector3Composite.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector3Composite.cs @@ -4,7 +4,6 @@ using UnityEngine.InputSystem.Utilities; #if UNITY_EDITOR -using UnityEditor; using UnityEngine.InputSystem.Editor; using UnityEngine.UIElements; #endif @@ -172,24 +171,20 @@ public enum Mode #if UNITY_EDITOR internal class Vector3CompositeEditor : InputParameterEditor { - private GUIContent m_ModeLabel = new GUIContent("Mode", - "How to synthesize a Vector3 from the inputs. Digital " + private const string label = "Mode"; + private const string tooltip = "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(m_ModeLabel.text, target.mode) + var modeField = new EnumField(label, target.mode) { - tooltip = m_ModeLabel.tooltip + tooltip = 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 9345d5f9b0..45f08e261f 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,11 +124,6 @@ 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 41610ced29..d068639dae 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/MultiTapInteraction.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/MultiTapInteraction.cs @@ -1,11 +1,9 @@ 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) @@ -196,21 +194,14 @@ 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(m_TapCountLabel.text) + var tapCountField = new IntegerField(tapLabel) { value = target.tapCount, - tooltip = m_TapCountLabel.tooltip + tooltip = tapTooltip }; tapCountField.RegisterValueChangedCallback(evt => { @@ -224,7 +215,8 @@ public override void OnDrawVisualElements(VisualElement root, Action onChangedCa m_PressPointSetting.OnDrawVisualElements(root, onChangedCallback); } - 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 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 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 f5361ae56b..3b7c7a20b0 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/PressInteraction.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/PressInteraction.cs @@ -1,12 +1,9 @@ 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 @@ -213,21 +210,15 @@ 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(s_HelpBoxText.text, HelpBoxMessageType.None)); + root.Add(new HelpBox(helpLabel, HelpBoxMessageType.None)); - var behaviourDropdown = new EnumField(s_PressBehaviorLabel.text, target.behavior) + var behaviourDropdown = new EnumField(triggerLabel, target.behavior) { - tooltip = s_PressBehaviorLabel.tooltip + tooltip = triggerTooltip }; behaviourDropdown.RegisterValueChangedCallback(evt => { @@ -241,14 +232,13 @@ public override void OnDrawVisualElements(VisualElement root, Action onChangedCa private CustomOrDefaultSetting m_PressPointSetting; - private static readonly GUIContent s_HelpBoxText = EditorGUIUtility.TrTextContent("Note that the 'Press' interaction is only " + private const string helpLabel = "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 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. " + + "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. " + "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 cb79393e00..6d663989b5 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/SlowTapInteraction.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/SlowTapInteraction.cs @@ -1,7 +1,6 @@ using System; using System.ComponentModel; using UnityEngine.InputSystem.Controls; -using UnityEngine.Scripting; #if UNITY_EDITOR using UnityEngine.InputSystem.Editor; using UnityEngine.UIElements; @@ -88,11 +87,6 @@ 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 984d35541c..55d1ea856e 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/TapInteraction.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/TapInteraction.cs @@ -1,7 +1,6 @@ using System; using System.ComponentModel; using UnityEngine.InputSystem.Controls; -using UnityEngine.Scripting; #if UNITY_EDITOR using UnityEngine.InputSystem.Editor; using UnityEngine.UIElements; @@ -114,11 +113,6 @@ 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 f86bb17c18..066eb2aaf4 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/AxisDeadzoneProcessor.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/AxisDeadzoneProcessor.cs @@ -1,5 +1,4 @@ using System; -using UnityEngine.Scripting; #if UNITY_EDITOR using UnityEngine.InputSystem.Editor; @@ -93,11 +92,6 @@ 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 631f7b51d5..1dec047010 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/StickDeadzoneProcessor.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/StickDeadzoneProcessor.cs @@ -1,5 +1,4 @@ using System; -using UnityEngine.Scripting; #if UNITY_EDITOR using UnityEngine.InputSystem.Editor; @@ -82,11 +81,6 @@ 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 ee986c9e16..dd719aa8f3 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. diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/ParameterListView.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/ParameterListView.cs index 25bd44764c..9b38064796 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/ParameterListView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/ParameterListView.cs @@ -4,7 +4,6 @@ using System.Linq; using System.Reflection; using UnityEditor; -using UnityEditor.UIElements; using UnityEngine.InputSystem.Layouts; using UnityEngine.InputSystem.Utilities; using UnityEngine.UIElements; @@ -135,7 +134,7 @@ public void Initialize(Type registeredType, ReadOnlyArray existingPa parameter.value = parameter.value.ConvertTo(underlyingTypeCode); // Read enum names and values. - parameter.enumNames = Enum.GetNames(fieldType).Select(x => new GUIContent(x)).ToArray(); + parameter.enumNames = Enum.GetNames(fieldType); ////REVIEW: this probably falls apart if multiple members have the same value var list = new List(); foreach (var value in Enum.GetValues(fieldType)) @@ -224,7 +223,7 @@ public void Initialize(Type registeredType, ReadOnlyArray existingPa m_ParameterEditor = null; // Create parameter labels. - m_ParameterLabels = new GUIContent[m_Parameters.Length]; + m_ParameterLabels = new(string text, string tooltip)[m_Parameters.Length]; for (var i = 0; i < m_Parameters.Length; ++i) { // Look up tooltip from field. @@ -236,7 +235,7 @@ public void Initialize(Type registeredType, ReadOnlyArray existingPa // Create label. var niceName = ObjectNames.NicifyVariableName(m_Parameters[i].value.name); - m_ParameterLabels[i] = new GUIContent(niceName, tooltip); + m_ParameterLabels[i] = (niceName, tooltip); } } } @@ -277,7 +276,7 @@ void OnEditEnd() if (parameter.isEnum) { - var names = parameter.enumNames.Select(c => c.text).ToList(); + var names = parameter.enumNames.ToList(); var rawValue = parameter.value.value.ToInt32(); var selectedIndex = parameter.enumValues.IndexOf(rawValue); if (selectedIndex < 0 || selectedIndex >= names.Count) @@ -350,72 +349,6 @@ 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? @@ -448,14 +381,15 @@ private void ReadParameterValuesFrom(object target) private InputParameterEditor m_ParameterEditor; private EditableParameterValue[] m_Parameters; - private GUIContent[] m_ParameterLabels; + + private (string text, string tooltip)[] m_ParameterLabels; private struct EditableParameterValue { public NamedValue value; public NamedValue? defaultValue; public int[] enumValues; - public GUIContent[] enumNames; + public string[] 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 9b9ccf4bcb..ae6e80c63a 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs @@ -58,9 +58,6 @@ 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 c0f0bade83..5c58afb174 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/NameAndParametersListView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/NameAndParametersListView.cs @@ -171,8 +171,6 @@ 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 a423c88084..013be0c13a 100644 --- a/Packages/com.unity.inputsystem/InputSystem/InputSettings.cs +++ b/Packages/com.unity.inputsystem/InputSystem/InputSettings.cs @@ -739,6 +739,11 @@ 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(); @@ -979,14 +984,8 @@ public enum InputActionPropertyDrawerMode } #if UNITY_EDITOR - /// - /// 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); + [Obsolete("useIMGUIEditorForAssets is obsolete and will be removed in a future release.")] + public bool useIMGUIEditorForAssets => false; #endif private static bool CompareFloats(float a, float b)