Skip to content

Commit d6fbcbb

Browse files
K-Toneekcoh
andauthored
CHANGE: Deprecate useIMGUIEditorForAssets (#2283)
Co-authored-by: Håkan Sidenvall <[email protected]>
1 parent ca41fbc commit d6fbcbb

File tree

19 files changed

+45
-198
lines changed

19 files changed

+45
-198
lines changed

Assets/Samples/CustomComposite/CustomComposite.cs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -136,13 +136,6 @@ public class CustomCompositeEditor : InputParameterEditor<CustomComposite>
136136
{
137137
public override void OnGUI()
138138
{
139-
// Using the 'target' property, we can access an instance of our composite.
140-
var currentValue = target.scaleFactor;
141-
142-
// The easiest way to lay out our UI is to simply use EditorGUILayout.
143-
// We simply assign the changed value back to the 'target' object. The input
144-
// system will automatically detect a change in value.
145-
target.scaleFactor = EditorGUILayout.Slider(m_ScaleFactorLabel, currentValue, 0, 2);
146139
}
147140

148141
public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback)

Assets/Tests/InputSystem/CoreTests_Actions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ partial class CoreTests
3535
[TestCase(InputFeatureNames.kParanoidReadValueCachingChecks)]
3636
[TestCase(InputFeatureNames.kDisableUnityRemoteSupport)]
3737
[TestCase(InputFeatureNames.kRunPlayerUpdatesInEditMode)]
38-
[TestCase(InputFeatureNames.kUseIMGUIEditorForAssets)]
3938
public void Settings_ShouldStoreSettingsAndFeatureFlags(string featureName)
4039
{
4140
using (var settings = Scoped.Object(InputSettings.CreateInstance<InputSettings>()))

Assets/Tests/InputSystem/CoreTests_Analytics.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,6 @@ public void Analytics_ShouldReportBuildAnalytics_WhenNotHavingSettingsAsset()
458458
Assert.That(data.feature_paranoid_read_value_caching_checks_enabled, Is.EqualTo(defaultSettings.IsFeatureEnabled(InputFeatureNames.kParanoidReadValueCachingChecks)));
459459
Assert.That(data.feature_disable_unity_remote_support, Is.EqualTo(defaultSettings.IsFeatureEnabled(InputFeatureNames.kDisableUnityRemoteSupport)));
460460
Assert.That(data.feature_run_player_updates_in_editmode, Is.EqualTo(defaultSettings.IsFeatureEnabled(InputFeatureNames.kRunPlayerUpdatesInEditMode)));
461-
Assert.That(data.feature_use_imgui_editor_for_assets, Is.EqualTo(defaultSettings.IsFeatureEnabled(InputFeatureNames.kUseIMGUIEditorForAssets)));
462461
}
463462
finally
464463
{
@@ -507,7 +506,6 @@ public void Analytics_ShouldReportBuildAnalytics_WhenHavingSettingsAssetWithCust
507506
customSettings.SetInternalFeatureFlag(InputFeatureNames.kParanoidReadValueCachingChecks, true);
508507
customSettings.SetInternalFeatureFlag(InputFeatureNames.kDisableUnityRemoteSupport, true);
509508
customSettings.SetInternalFeatureFlag(InputFeatureNames.kRunPlayerUpdatesInEditMode, true);
510-
customSettings.SetInternalFeatureFlag(InputFeatureNames.kUseIMGUIEditorForAssets, true);
511509
customSettings.SetInternalFeatureFlag(InputFeatureNames.kUseReadValueCaching, true);
512510

513511
InputSystem.settings = customSettings;
@@ -554,7 +552,6 @@ public void Analytics_ShouldReportBuildAnalytics_WhenHavingSettingsAssetWithCust
554552
Assert.That(data.feature_paranoid_read_value_caching_checks_enabled, Is.True);
555553
Assert.That(data.feature_disable_unity_remote_support, Is.True);
556554
Assert.That(data.feature_run_player_updates_in_editmode, Is.True);
557-
Assert.That(data.feature_use_imgui_editor_for_assets, Is.True);
558555
}
559556
finally
560557
{

Packages/com.unity.inputsystem/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,10 @@ however, it has to be formatted properly to pass verification tests.
1111
## [Unreleased] - yyyy-mm-dd
1212

1313
### Changed
14-
- Project-Wide Input Actions support can no longer be disabled (removed the UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS define). (ISX-2397)
14+
- Project-Wide Input Actions support can no longer be compiled out (removed the `UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS` define). (ISX-2397)
1515
- Removed code that had to do with Unity versions older than Unity 2022.3 LTS. (ISX-2396)
1616
- Auto-save on focus lost can no longer be compiled out (ISX-2397)
17+
- Deprecated the `USE_IMGUI_EDITOR_FOR_ASSETS` feature option (ISX-2397)
1718

1819
### Fixed
1920
- 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)

Packages/com.unity.inputsystem/InputSystem/Actions/Composites/AxisComposite.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
#if UNITY_EDITOR
77
using System;
8-
using UnityEditor;
98
using UnityEngine.InputSystem.Editor;
109
using UnityEngine.UIElements;
1110
#endif
@@ -212,24 +211,20 @@ public enum WhichSideWins
212211
#if UNITY_EDITOR
213212
internal class AxisCompositeEditor : InputParameterEditor<AxisComposite>
214213
{
215-
private GUIContent m_WhichAxisWinsLabel = new GUIContent("Which Side Wins",
216-
"Determine which axis 'wins' if both are actuated at the same time. "
214+
private const string label = "Which Side Wins";
215+
private const string tooltipText = "Determine which axis 'wins' if both are actuated at the same time. "
217216
+ "If 'Neither' is selected, the result is 0 (or, more precisely, "
218-
+ "the midpoint between minValue and maxValue).");
217+
+ "the midpoint between minValue and maxValue).";
219218

220219
public override void OnGUI()
221220
{
222-
if (!InputSystem.settings.useIMGUIEditorForAssets)
223-
return;
224-
225-
target.whichSideWins = (AxisComposite.WhichSideWins)EditorGUILayout.EnumPopup(m_WhichAxisWinsLabel, target.whichSideWins);
226221
}
227222

228223
public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback)
229224
{
230-
var modeField = new EnumField(m_WhichAxisWinsLabel.text, target.whichSideWins)
225+
var modeField = new EnumField(label, target.whichSideWins)
231226
{
232-
tooltip = m_WhichAxisWinsLabel.tooltip
227+
tooltip = tooltipText
233228
};
234229

235230
modeField.RegisterValueChangedCallback(evt =>

Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector2Composite.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using UnityEngine.InputSystem.Utilities;
66

77
#if UNITY_EDITOR
8-
using UnityEditor;
98
using UnityEngine.InputSystem.Editor;
109
using UnityEngine.UIElements;
1110
#endif
@@ -192,24 +191,20 @@ public enum Mode
192191
#if UNITY_EDITOR
193192
internal class Vector2CompositeEditor : InputParameterEditor<Vector2Composite>
194193
{
195-
private GUIContent m_ModeLabel = new GUIContent("Mode",
196-
"How to synthesize a Vector2 from the inputs. Digital "
194+
private const string label = "Mode";
195+
private const string tooltipText = "How to synthesize a Vector2 from the inputs. Digital "
197196
+ "treats part bindings as buttons (on/off) whereas Analog preserves "
198-
+ "floating-point magnitudes as read from controls.");
197+
+ "floating-point magnitudes as read from controls.";
199198

200199
public override void OnGUI()
201200
{
202-
if (!InputSystem.settings.useIMGUIEditorForAssets)
203-
return;
204-
205-
target.mode = (Vector2Composite.Mode)EditorGUILayout.EnumPopup(m_ModeLabel, target.mode);
206201
}
207202

208203
public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback)
209204
{
210-
var modeField = new EnumField(m_ModeLabel.text, target.mode)
205+
var modeField = new EnumField(label, target.mode)
211206
{
212-
tooltip = m_ModeLabel.tooltip
207+
tooltip = tooltipText
213208
};
214209

215210
modeField.RegisterValueChangedCallback(evt =>

Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector3Composite.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
using UnityEngine.InputSystem.Utilities;
55

66
#if UNITY_EDITOR
7-
using UnityEditor;
87
using UnityEngine.InputSystem.Editor;
98
using UnityEngine.UIElements;
109
#endif
@@ -172,24 +171,20 @@ public enum Mode
172171
#if UNITY_EDITOR
173172
internal class Vector3CompositeEditor : InputParameterEditor<Vector3Composite>
174173
{
175-
private GUIContent m_ModeLabel = new GUIContent("Mode",
176-
"How to synthesize a Vector3 from the inputs. Digital "
174+
private const string label = "Mode";
175+
private const string tooltip = "How to synthesize a Vector3 from the inputs. Digital "
177176
+ "treats part bindings as buttons (on/off) whereas Analog preserves "
178-
+ "floating-point magnitudes as read from controls.");
177+
+ "floating-point magnitudes as read from controls.";
179178

180179
public override void OnGUI()
181180
{
182-
if (!InputSystem.settings.useIMGUIEditorForAssets)
183-
return;
184-
185-
target.mode = (Vector3Composite.Mode)EditorGUILayout.EnumPopup(m_ModeLabel, target.mode);
186181
}
187182

188183
public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback)
189184
{
190-
var modeField = new EnumField(m_ModeLabel.text, target.mode)
185+
var modeField = new EnumField(label, target.mode)
191186
{
192-
tooltip = m_ModeLabel.tooltip
187+
tooltip = tooltip
193188
};
194189

195190
modeField.RegisterValueChangedCallback(evt =>

Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/HoldInteraction.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System;
22
using System.ComponentModel;
33
using UnityEngine.InputSystem.Controls;
4-
using UnityEngine.Scripting;
4+
55
#if UNITY_EDITOR
66
using UnityEngine.InputSystem.Editor;
77
using UnityEngine.UIElements;
@@ -124,11 +124,6 @@ protected override void OnEnable()
124124

125125
public override void OnGUI()
126126
{
127-
if (!InputSystem.settings.useIMGUIEditorForAssets)
128-
return;
129-
130-
m_PressPointSetting.OnGUI();
131-
m_DurationSetting.OnGUI();
132127
}
133128

134129
public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback)

Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/MultiTapInteraction.cs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
using System;
22
using UnityEngine.InputSystem.Controls;
3-
using UnityEngine.Scripting;
3+
44
#if UNITY_EDITOR
5-
using UnityEditor;
65
using UnityEngine.InputSystem.Editor;
76
using UnityEngine.UIElements;
8-
using UnityEditor.UIElements;
97
#endif
108

119
////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()
196194

197195
public override void OnGUI()
198196
{
199-
if (!InputSystem.settings.useIMGUIEditorForAssets)
200-
return;
201-
202-
target.tapCount = EditorGUILayout.IntField(m_TapCountLabel, target.tapCount);
203-
m_TapDelaySetting.OnGUI();
204-
m_TapTimeSetting.OnGUI();
205-
m_PressPointSetting.OnGUI();
206197
}
207198

208199
public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback)
209200
{
210-
var tapCountField = new IntegerField(m_TapCountLabel.text)
201+
var tapCountField = new IntegerField(tapLabel)
211202
{
212203
value = target.tapCount,
213-
tooltip = m_TapCountLabel.tooltip
204+
tooltip = tapTooltip
214205
};
215206
tapCountField.RegisterValueChangedCallback(evt =>
216207
{
@@ -224,7 +215,8 @@ public override void OnDrawVisualElements(VisualElement root, Action onChangedCa
224215
m_PressPointSetting.OnDrawVisualElements(root, onChangedCallback);
225216
}
226217

227-
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.");
218+
private const string tapLabel = "Tap Count";
219+
private const string tapTooltip = "How many taps need to be performed in succession. Two means double-tap, three means triple-tap, and so on.";
228220

229221
private CustomOrDefaultSetting m_PressPointSetting;
230222
private CustomOrDefaultSetting m_TapTimeSetting;

Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/PressInteraction.cs

Lines changed: 8 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
using System;
22
using System.ComponentModel;
33
using UnityEngine.InputSystem.Controls;
4-
using UnityEngine.Scripting;
54
#if UNITY_EDITOR
6-
using UnityEditor;
75
using UnityEngine.InputSystem.Editor;
86
using UnityEngine.UIElements;
9-
using UnityEditor.UIElements;
107
#endif
118

129
////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()
213210

214211
public override void OnGUI()
215212
{
216-
if (!InputSystem.settings.useIMGUIEditorForAssets)
217-
return;
218-
219-
EditorGUILayout.HelpBox(s_HelpBoxText);
220-
target.behavior = (PressBehavior)EditorGUILayout.EnumPopup(s_PressBehaviorLabel, target.behavior);
221-
m_PressPointSetting.OnGUI();
222213
}
223214

224215
public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback)
225216
{
226-
root.Add(new HelpBox(s_HelpBoxText.text, HelpBoxMessageType.None));
217+
root.Add(new HelpBox(helpLabel, HelpBoxMessageType.None));
227218

228-
var behaviourDropdown = new EnumField(s_PressBehaviorLabel.text, target.behavior)
219+
var behaviourDropdown = new EnumField(triggerLabel, target.behavior)
229220
{
230-
tooltip = s_PressBehaviorLabel.tooltip
221+
tooltip = triggerTooltip
231222
};
232223
behaviourDropdown.RegisterValueChangedCallback(evt =>
233224
{
@@ -241,14 +232,13 @@ public override void OnDrawVisualElements(VisualElement root, Action onChangedCa
241232

242233
private CustomOrDefaultSetting m_PressPointSetting;
243234

244-
private static readonly GUIContent s_HelpBoxText = EditorGUIUtility.TrTextContent("Note that the 'Press' interaction is only "
235+
private const string helpLabel = "Note that the 'Press' interaction is only "
245236
+ "necessary when wanting to customize button press behavior. For default press behavior, simply set the action type to 'Button' "
246-
+ "and use the action without interactions added to it.");
247-
248-
private static readonly GUIContent s_PressBehaviorLabel = EditorGUIUtility.TrTextContent("Trigger Behavior",
249-
"Determines how button presses trigger the action. By default (PressOnly), the action is performed on press. "
237+
+ "and use the action without interactions added to it.";
238+
private const string triggerLabel = "Trigger Behavior";
239+
private const string triggerTooltip = "Determines how button presses trigger the action. By default (PressOnly), the action is performed on press. "
250240
+ "With ReleaseOnly, the action is performed on release. With PressAndRelease, the action is performed on press and "
251-
+ "canceled on release.");
241+
+ "canceled on release.";
252242
}
253243
#endif
254244
}

0 commit comments

Comments
 (0)