From 3c31da8c61912e668532b18f2450b1cdb94948b7 Mon Sep 17 00:00:00 2001 From: Anthony Yakovlev Date: Wed, 5 Nov 2025 14:43:29 +0300 Subject: [PATCH 1/6] remove the UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS define from our code base --- .../Actions/Composites/AxisComposite.cs | 9 ++--- .../Actions/Composites/Vector2Composite.cs | 9 ++--- .../Actions/Composites/Vector3Composite.cs | 9 ++--- .../InputSystem/Actions/InputActionAsset.cs | 2 - .../InputSystem/Actions/InputControlScheme.cs | 2 +- .../Actions/Interactions/HoldInteraction.cs | 9 ++--- .../Interactions/MultiTapInteraction.cs | 9 ++--- .../Actions/Interactions/PressInteraction.cs | 9 ++--- .../Interactions/SlowTapInteraction.cs | 9 ++--- .../Actions/Interactions/TapInteraction.cs | 9 ++--- .../Processors/AxisDeadzoneProcessor.cs | 9 ++--- .../Processors/StickDeadzoneProcessor.cs | 9 ++--- .../Editor/Analytics/InputBuildAnalytic.cs | 9 +---- .../AssetEditor/InputActionEditorWindow.cs | 38 +------------------ .../Editor/AssetEditor/ParameterListView.cs | 8 ++-- .../AssetImporter/InputActionImporter.cs | 2 - .../InputActionImporterEditor.cs | 13 +------ .../ControlPicker/InputControlPathEditor.cs | 2 - .../InputControlPickerDropdown.cs | 4 -- .../Editor/InputParameterEditor.cs | 9 ----- .../InputActionSerializationHelpers.cs | 3 -- .../ProjectWideActionsAsset.cs | 4 +- .../ProjectWideActionsBuildProvider.cs | 4 +- .../PropertyDrawers/InputActionAssetDrawer.cs | 4 +- .../InputActionAssetSearchProvider.cs | 2 +- .../InputActionReferencePropertyDrawer.cs | 14 ------- .../InputActionReferenceSearchProviders.cs | 2 +- .../Editor/Settings/InputSettingsProvider.cs | 8 ---- .../UITKAssetEditor/Commands/Commands.cs | 2 +- .../Commands/ControlSchemeCommands.cs | 2 +- .../InputActionsEditorSettingsProvider.cs | 2 +- .../InputActionsEditorState.cs | 2 +- .../InputActionsEditorWindow.cs | 8 ++-- .../UITKAssetEditor/SerializedInputAction.cs | 2 +- .../UITKAssetEditor/SerializedInputBinding.cs | 2 +- .../Editor/UITKAssetEditor/StateContainer.cs | 2 +- .../UITKAssetEditor/Views/ActionMapsView.cs | 2 +- .../Views/ActionPropertiesView.cs | 2 +- .../UITKAssetEditor/Views/ActionsTreeView.cs | 4 +- .../Views/BindingPropertiesView.cs | 2 +- .../CollectionViewSelectionChangeFilter.cs | 2 +- .../Views/CompositeBindingPropertiesView.cs | 2 +- .../CompositePartBindingPropertiesView.cs | 2 +- .../UITKAssetEditor/Views/ContextMenu.cs | 2 +- .../Views/ControlSchemesView.cs | 2 +- .../UITKAssetEditor/Views/CopyPasteHelper.cs | 2 +- .../UITKAssetEditor/Views/DropManipulator.cs | 2 +- .../Views/InputActionMapsTreeViewItem.cs | 4 +- .../Views/InputActionsEditorView.cs | 2 +- .../Views/InputActionsTreeViewItem.cs | 4 +- .../Views/MatchingControlPaths.cs | 2 +- .../Views/NameAndParametersListView.cs | 2 +- .../UITKAssetEditor/Views/PropertiesView.cs | 2 +- .../Editor/UITKAssetEditor/Views/Selectors.cs | 2 +- .../Editor/UITKAssetEditor/Views/ViewBase.cs | 2 +- .../Views/VisualElementExtensions.cs | 2 +- .../InputSystem/InputFeatureNames.cs | 2 - .../InputSystem/InputManager.cs | 22 ----------- .../InputSystem/InputSettings.cs | 6 +-- .../InputSystem/InputSystem.cs | 12 ------ .../Plugins/PlayerInput/PlayerInput.cs | 2 +- .../Plugins/PlayerInput/PlayerInputEditor.cs | 3 +- .../InputSystem/Unity.InputSystem.asmdef | 5 --- 63 files changed, 77 insertions(+), 263 deletions(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/AxisComposite.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/AxisComposite.cs index 48ae2a7c0e..acf12d4117 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/AxisComposite.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/AxisComposite.cs @@ -219,13 +219,12 @@ internal class AxisCompositeEditor : InputParameterEditor public override void OnGUI() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS - if (!InputSystem.settings.useIMGUIEditorForAssets) return; -#endif + if (!InputSystem.settings.useIMGUIEditorForAssets) + return; + target.whichSideWins = (AxisComposite.WhichSideWins)EditorGUILayout.EnumPopup(m_WhichAxisWinsLabel, target.whichSideWins); } -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback) { var modeField = new EnumField(m_WhichAxisWinsLabel.text, target.whichSideWins) @@ -241,8 +240,6 @@ public override void OnDrawVisualElements(VisualElement root, Action onChangedCa root.Add(modeField); } - -#endif } #endif } diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector2Composite.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector2Composite.cs index 2f970dda8b..5a60e472d4 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector2Composite.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector2Composite.cs @@ -199,13 +199,12 @@ internal class Vector2CompositeEditor : InputParameterEditor public override void OnGUI() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS - if (!InputSystem.settings.useIMGUIEditorForAssets) return; -#endif + if (!InputSystem.settings.useIMGUIEditorForAssets) + return; + target.mode = (Vector2Composite.Mode)EditorGUILayout.EnumPopup(m_ModeLabel, target.mode); } -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback) { var modeField = new EnumField(m_ModeLabel.text, target.mode) @@ -221,8 +220,6 @@ public override void OnDrawVisualElements(VisualElement root, Action onChangedCa root.Add(modeField); } - -#endif } #endif } diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector3Composite.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector3Composite.cs index d9a0e510c4..af3243ffc4 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector3Composite.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector3Composite.cs @@ -179,13 +179,12 @@ internal class Vector3CompositeEditor : InputParameterEditor public override void OnGUI() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS - if (!InputSystem.settings.useIMGUIEditorForAssets) return; -#endif + if (!InputSystem.settings.useIMGUIEditorForAssets) + return; + target.mode = (Vector3Composite.Mode)EditorGUILayout.EnumPopup(m_ModeLabel, target.mode); } -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback) { var modeField = new EnumField(m_ModeLabel.text, target.mode) @@ -201,8 +200,6 @@ public override void OnDrawVisualElements(VisualElement root, Action onChangedCa root.Add(modeField); } - -#endif } #endif } diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/InputActionAsset.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/InputActionAsset.cs index e655a6a712..bf91ff49f4 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/InputActionAsset.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/InputActionAsset.cs @@ -953,9 +953,7 @@ private void OnDestroy() [SerializeField] internal InputActionMap[] m_ActionMaps; [SerializeField] internal InputControlScheme[] m_ControlSchemes; - #if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS [SerializeField] internal bool m_IsProjectWide; - #endif ////TODO: make this persistent across domain reloads /// diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/InputControlScheme.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/InputControlScheme.cs index bb15893a61..7508bb984c 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/InputControlScheme.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/InputControlScheme.cs @@ -112,7 +112,7 @@ public InputControlScheme(string name, IEnumerable devices = } } - #if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS + #if UNITY_EDITOR internal InputControlScheme(SerializedProperty sp) { var requirements = new List(); diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/HoldInteraction.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/HoldInteraction.cs index 79e057da25..ae3fdebd13 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/HoldInteraction.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/HoldInteraction.cs @@ -124,22 +124,19 @@ protected override void OnEnable() public override void OnGUI() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS - if (!InputSystem.settings.useIMGUIEditorForAssets) return; -#endif + if (!InputSystem.settings.useIMGUIEditorForAssets) + return; + m_PressPointSetting.OnGUI(); m_DurationSetting.OnGUI(); } -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback) { m_PressPointSetting.OnDrawVisualElements(root, onChangedCallback); m_DurationSetting.OnDrawVisualElements(root, onChangedCallback); } -#endif - private CustomOrDefaultSetting m_PressPointSetting; private CustomOrDefaultSetting m_DurationSetting; } diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/MultiTapInteraction.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/MultiTapInteraction.cs index 35768ca1b5..762a6850f4 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/MultiTapInteraction.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/MultiTapInteraction.cs @@ -196,16 +196,15 @@ protected override void OnEnable() public override void OnGUI() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS - if (!InputSystem.settings.useIMGUIEditorForAssets) return; -#endif + if (!InputSystem.settings.useIMGUIEditorForAssets) + return; + target.tapCount = EditorGUILayout.IntField(m_TapCountLabel, target.tapCount); m_TapDelaySetting.OnGUI(); m_TapTimeSetting.OnGUI(); m_PressPointSetting.OnGUI(); } -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback) { var tapCountField = new IntegerField(m_TapCountLabel.text) @@ -225,8 +224,6 @@ public override void OnDrawVisualElements(VisualElement root, Action onChangedCa m_PressPointSetting.OnDrawVisualElements(root, onChangedCallback); } -#endif - 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; diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/PressInteraction.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/PressInteraction.cs index 33cdb0bc79..8d04f3bc4b 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/PressInteraction.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/PressInteraction.cs @@ -213,15 +213,14 @@ protected override void OnEnable() public override void OnGUI() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS - if (!InputSystem.settings.useIMGUIEditorForAssets) return; -#endif + if (!InputSystem.settings.useIMGUIEditorForAssets) + return; + EditorGUILayout.HelpBox(s_HelpBoxText); target.behavior = (PressBehavior)EditorGUILayout.EnumPopup(s_PressBehaviorLabel, target.behavior); m_PressPointSetting.OnGUI(); } -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback) { root.Add(new HelpBox(s_HelpBoxText.text, HelpBoxMessageType.None)); @@ -240,8 +239,6 @@ public override void OnDrawVisualElements(VisualElement root, Action onChangedCa m_PressPointSetting.OnDrawVisualElements(root, onChangedCallback); } -#endif - private CustomOrDefaultSetting m_PressPointSetting; private static readonly GUIContent s_HelpBoxText = EditorGUIUtility.TrTextContent("Note that the 'Press' interaction is only " diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/SlowTapInteraction.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/SlowTapInteraction.cs index 5309ab7a5d..677f142149 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/SlowTapInteraction.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/SlowTapInteraction.cs @@ -88,22 +88,19 @@ protected override void OnEnable() public override void OnGUI() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS - if (!InputSystem.settings.useIMGUIEditorForAssets) return; -#endif + if (!InputSystem.settings.useIMGUIEditorForAssets) + return; + m_DurationSetting.OnGUI(); m_PressPointSetting.OnGUI(); } -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback) { m_DurationSetting.OnDrawVisualElements(root, onChangedCallback); m_PressPointSetting.OnDrawVisualElements(root, onChangedCallback); } -#endif - private CustomOrDefaultSetting m_DurationSetting; private CustomOrDefaultSetting m_PressPointSetting; } diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/TapInteraction.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/TapInteraction.cs index 510b1caef2..984d35541c 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/TapInteraction.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/TapInteraction.cs @@ -114,22 +114,19 @@ protected override void OnEnable() public override void OnGUI() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS - if (!InputSystem.settings.useIMGUIEditorForAssets) return; -#endif + if (!InputSystem.settings.useIMGUIEditorForAssets) + return; + m_DurationSetting.OnGUI(); m_PressPointSetting.OnGUI(); } -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback) { m_DurationSetting.OnDrawVisualElements(root, onChangedCallback); m_PressPointSetting.OnDrawVisualElements(root, onChangedCallback); } -#endif - private CustomOrDefaultSetting m_DurationSetting; private CustomOrDefaultSetting m_PressPointSetting; } diff --git a/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/AxisDeadzoneProcessor.cs b/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/AxisDeadzoneProcessor.cs index d9c33718a4..029ee50d73 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/AxisDeadzoneProcessor.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/AxisDeadzoneProcessor.cs @@ -93,22 +93,19 @@ protected override void OnEnable() public override void OnGUI() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS - if (!InputSystem.settings.useIMGUIEditorForAssets) return; -#endif + if (!InputSystem.settings.useIMGUIEditorForAssets) + return; + m_MinSetting.OnGUI(); m_MaxSetting.OnGUI(); } -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback) { m_MinSetting.OnDrawVisualElements(root, onChangedCallback); m_MaxSetting.OnDrawVisualElements(root, onChangedCallback); } -#endif - private CustomOrDefaultSetting m_MinSetting; private CustomOrDefaultSetting m_MaxSetting; } diff --git a/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/StickDeadzoneProcessor.cs b/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/StickDeadzoneProcessor.cs index b0115b977b..e08540d279 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/StickDeadzoneProcessor.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/StickDeadzoneProcessor.cs @@ -82,22 +82,19 @@ protected override void OnEnable() public override void OnGUI() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS - if (!InputSystem.settings.useIMGUIEditorForAssets) return; -#endif + if (!InputSystem.settings.useIMGUIEditorForAssets) + return; + m_MinSetting.OnGUI(); m_MaxSetting.OnGUI(); } -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback) { m_MinSetting.OnDrawVisualElements(root, onChangedCallback); m_MaxSetting.OnDrawVisualElements(root, onChangedCallback); } -#endif - private CustomOrDefaultSetting m_MinSetting; private CustomOrDefaultSetting m_MaxSetting; } diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/Analytics/InputBuildAnalytic.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/Analytics/InputBuildAnalytic.cs index 40bb709409..ee986c9e16 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/Analytics/InputBuildAnalytic.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/Analytics/InputBuildAnalytic.cs @@ -167,13 +167,9 @@ public InputBuildAnalyticData(BuildReport report, InputSettings settings, InputS throw new Exception("Unsupported editor property drawer mode"); } -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS var inputSystemActions = InputSystem.actions; var actionsPath = inputSystemActions == null ? null : AssetDatabase.GetAssetPath(inputSystemActions); has_projectwide_input_action_asset = !string.IsNullOrEmpty(actionsPath); -#else - has_projectwide_input_action_asset = false; -#endif var settingsPath = settings == null ? null : AssetDatabase.GetAssetPath(settings); has_settings_asset = !string.IsNullOrEmpty(settingsPath); @@ -199,12 +195,9 @@ public InputBuildAnalyticData(BuildReport report, InputSettings settings, InputS feature_paranoid_read_value_caching_checks_enabled = settings.IsFeatureEnabled(InputFeatureNames.kParanoidReadValueCachingChecks); -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS feature_use_imgui_editor_for_assets = settings.IsFeatureEnabled(InputFeatureNames.kUseIMGUIEditorForAssets); -#else - feature_use_imgui_editor_for_assets = false; -#endif + feature_disable_unity_remote_support = settings.IsFeatureEnabled(InputFeatureNames.kDisableUnityRemoteSupport); feature_run_player_updates_in_editmode = diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs index 1e88a026dc..dd9af16116 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs @@ -69,10 +69,9 @@ public static bool OpenAsset(int instanceId, int line) /// private static bool OpenAsset(Object obj) { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS if (!InputSystem.settings.useIMGUIEditorForAssets) return false; -#endif + string mapToSelect = null; string actionToSelect = null; @@ -792,41 +791,6 @@ private void ReloadAssetFromFileIfNotDirty() Repaint(); } -#if !UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS - ////TODO: add shortcut to focus search box - - ////TODO: show shortcuts in tooltips - ////FIXME: the shortcuts seem to have focus problems; often requires clicking away and then back to the window - [Shortcut("Input Action Editor/Save", typeof(InputActionEditorWindow), KeyCode.S, ShortcutModifiers.Alt)] - private static void SaveShortcut(ShortcutArguments arguments) - { - var window = (InputActionEditorWindow)arguments.context; - window.SaveChangesToAsset(); - } - - [Shortcut("Input Action Editor/Add Action Map", typeof(InputActionEditorWindow), KeyCode.M, ShortcutModifiers.Alt)] - private static void AddActionMapShortcut(ShortcutArguments arguments) - { - var window = (InputActionEditorWindow)arguments.context; - window.AddNewActionMap(); - } - - [Shortcut("Input Action Editor/Add Action", typeof(InputActionEditorWindow), KeyCode.A, ShortcutModifiers.Alt)] - private static void AddActionShortcut(ShortcutArguments arguments) - { - var window = (InputActionEditorWindow)arguments.context; - window.AddNewAction(); - } - - [Shortcut("Input Action Editor/Add Binding", typeof(InputActionEditorWindow), KeyCode.B, ShortcutModifiers.Alt)] - private static void AddBindingShortcut(ShortcutArguments arguments) - { - var window = (InputActionEditorWindow)arguments.context; - window.AddNewBinding(); - } - -#endif - private void OnDirtyChanged(bool dirty) { titleContent = dirty ? m_DirtyTitle : m_Title; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/ParameterListView.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/ParameterListView.cs index 2828d7654a..31c4b14216 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/ParameterListView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/ParameterListView.cs @@ -247,7 +247,6 @@ public void Clear() m_ParameterEditor = null; } -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS public void OnDrawVisualElements(VisualElement root) { if (m_ParameterEditor != null) @@ -343,7 +342,6 @@ void OnEditEnd() } } -#endif private void OnValuesChanged() { @@ -366,10 +364,10 @@ public void OnGUI() return; } -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // handled by OnDrawVisualElements with UI Toolkit - if (!InputSystem.settings.useIMGUIEditorForAssets) return; -#endif + if (!InputSystem.settings.useIMGUIEditorForAssets) + return; + // Otherwise, fall back to our default logic. if (m_Parameters == null) return; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporter.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporter.cs index 27211e519d..477f9ce31f 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporter.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporter.cs @@ -286,7 +286,6 @@ internal static IEnumerable LoadInputActionReferencesFromA .Cast(); } -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS private static readonly string[] s_DefaultAssetSearchFolders = new string[] { "Assets" }; /// @@ -325,7 +324,6 @@ internal static IEnumerable LoadInputActionReferencesFromA return inputActionReferencesList; } -#endif // Add item to plop an .inputactions asset into the project. [MenuItem("Assets/Create/Input Actions")] diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporterEditor.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporterEditor.cs index b1c9a4ce5e..09f16305be 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporterEditor.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporterEditor.cs @@ -38,14 +38,12 @@ public override void OnInspectorGUI() EditorGUILayout.Space(); -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Project-wide Input Actions Asset UI. InputAssetEditorUtils.DrawMakeActiveGui(InputSystem.actions, inputActionAsset, inputActionAsset ? inputActionAsset.name : "Null", "Project-wide Input Actions", (value) => InputSystem.actions = value, !EditorApplication.isPlayingOrWillChangePlaymode); EditorGUILayout.Space(); -#endif // Importer settings UI. var generateWrapperCodeProperty = serializedObject.FindProperty("m_GenerateWrapperCode"); @@ -108,7 +106,6 @@ private InputActionAsset GetAsset() return assetTarget as InputActionAsset; } -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS protected override bool ShouldHideOpenButton() { return IsProjectWideActionsAsset(); @@ -124,20 +121,16 @@ private static bool IsProjectWideActionsAsset(InputActionAsset asset) return !ReferenceEquals(asset, null) && InputSystem.actions == asset; } -#endif - private string GetOpenEditorButtonText(InputActionAsset asset) { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS if (IsProjectWideActionsAsset(asset)) return "Edit in Project Settings Window"; -#endif + return "Edit Asset"; } private static void OpenEditor(InputActionAsset asset) { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Redirect to Project-settings Input Actions editor if this is the project-wide actions asset if (IsProjectWideActionsAsset(asset)) { @@ -150,10 +143,6 @@ private static void OpenEditor(InputActionAsset asset) InputActionsEditorWindow.OpenEditor(asset); else InputActionEditorWindow.OpenEditor(asset); -#else - // Redirect to IMGUI editor - InputActionEditorWindow.OpenEditor(asset); -#endif } private readonly GUIContent m_GenerateWrapperCodeLabel = EditorGUIUtility.TrTextContent("Generate C# Class"); diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs index 5b53b0964e..cf964d13b8 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPathEditor.cs @@ -161,9 +161,7 @@ public void OnGUI(Rect rect, GUIContent label = null, SerializedProperty propert private void ShowDropdown(Rect rect, SerializedProperty serializedProperty, Action modifiedCallback) { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS InputActionsEditorSettingsProvider.SetIMGUIDropdownVisible(true, false); -#endif IsShowingDropdown = true; if (m_PickerDropdown == null) diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPickerDropdown.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPickerDropdown.cs index 6609f622f5..b8f29118a6 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPickerDropdown.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/ControlPicker/InputControlPickerDropdown.cs @@ -65,9 +65,7 @@ public void SetPickedCallback(Action action) protected override void OnDestroy() { - #if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS InputActionsEditorSettingsProvider.SetIMGUIDropdownVisible(false, false); - #endif m_RebindingOperation?.Dispose(); m_RebindingOperation = null; } @@ -123,9 +121,7 @@ protected override AdvancedDropdownItem BuildCustomSearch(string searchString, protected override void ItemSelected(AdvancedDropdownItem item) { - #if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS InputActionsEditorSettingsProvider.SetIMGUIDropdownVisible(false, true); - #endif var path = ((InputControlDropdownItem)item).controlPathWithDevice; m_OnPickCallback(path); } diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/InputParameterEditor.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/InputParameterEditor.cs index ba2bf38db7..2b5d28e7a7 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/InputParameterEditor.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/InputParameterEditor.cs @@ -32,7 +32,6 @@ public abstract class InputParameterEditor /// public abstract void OnGUI(); -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS /// /// Add visual elements for this parameter editor to a root VisualElement. /// @@ -40,7 +39,6 @@ public abstract class InputParameterEditor /// A callback that will be called when any of the parameter editors /// changes value. public abstract void OnDrawVisualElements(VisualElement root, Action onChangedCallback); -#endif internal abstract void SetTarget(object target); @@ -182,7 +180,6 @@ internal override void SetTarget(object target) OnEnable(); } -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS /// /// Default stub implementation of . /// Should be overridden to create the desired UI. @@ -191,8 +188,6 @@ public override void OnDrawVisualElements(VisualElement root, Action onChangedCa { } -#endif - /// /// Helper for parameters that have defaults (usually from ). /// @@ -223,7 +218,6 @@ public void Initialize(string label, string tooltip, string defaultName, Func evt, Action onChangedCallba m_FloatField?.SetEnabled(!m_UseDefaultValue); } -#endif private void SetValue(float newValue) { // ReSharper disable once CompareOfFloatsByEqualityOperator @@ -406,9 +399,7 @@ public void OnGUI() private FloatField m_FloatField; private Button m_OpenInputSettingsButton; private Toggle m_DefaultToggle; -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS private HelpBox m_HelpBox; -#endif } } } diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/Internal/InputActionSerializationHelpers.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/Internal/InputActionSerializationHelpers.cs index 0e110c8219..f9c241594f 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/Internal/InputActionSerializationHelpers.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/Internal/InputActionSerializationHelpers.cs @@ -112,7 +112,6 @@ public static int ConvertBindingIndexOnActionToBindingIndexInArray(SerializedPro return indexInArray; } -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS public static void AddActionMaps(SerializedObject asset, SerializedObject sourceAsset) { Debug.Assert(asset.targetObject is InputActionAsset); @@ -145,8 +144,6 @@ public static void AddControlSchemes(SerializedObject asset, SerializedObject so dst.RestoreFromJson(buffer.ToString()); } -#endif - public static SerializedProperty AddActionMap(SerializedObject asset, int index = -1) { if (!(asset.targetObject is InputActionAsset)) diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/ProjectWideActions/ProjectWideActionsAsset.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/ProjectWideActions/ProjectWideActionsAsset.cs index 5b67f0acad..93c4b40073 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/ProjectWideActions/ProjectWideActionsAsset.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/ProjectWideActions/ProjectWideActionsAsset.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using System.Collections.Generic; @@ -343,4 +343,4 @@ private static InputActionAsset CreateAssetAtPathFromJson(string assetPath, stri } } } -#endif // UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#endif // UNITY_EDITOR diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/ProjectWideActions/ProjectWideActionsBuildProvider.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/ProjectWideActions/ProjectWideActionsBuildProvider.cs index afdff6f134..cebcacfcdc 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/ProjectWideActions/ProjectWideActionsBuildProvider.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/ProjectWideActions/ProjectWideActionsBuildProvider.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using System.Linq; using UnityEditor; @@ -71,4 +71,4 @@ public void OnPostprocessBuild(BuildReport report) } } -#endif // UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#endif // UNITY_EDITOR diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionAssetDrawer.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionAssetDrawer.cs index 779a5da2d3..623afc9c0b 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionAssetDrawer.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionAssetDrawer.cs @@ -1,6 +1,4 @@ -// Note: If not UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS we do not use a custom property drawer and -// picker for InputActionAsset but rather rely on default (classic) object picker. -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using UnityEditor; using UnityEditor.Search; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionAssetSearchProvider.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionAssetSearchProvider.cs index 1b0e638e10..6604a61287 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionAssetSearchProvider.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionAssetSearchProvider.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using System.Collections.Generic; using UnityEditor; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionReferencePropertyDrawer.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionReferencePropertyDrawer.cs index c9c9df4d31..b660547db6 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionReferencePropertyDrawer.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionReferencePropertyDrawer.cs @@ -1,12 +1,8 @@ -// Note: If not UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS we do not use a custom property drawer and -// picker for InputActionReferences but rather rely on default (classic) object picker. #if UNITY_EDITOR using UnityEditor; using UnityEditor.UIElements; -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS using UnityEditor.Search; using ObjectField = UnityEditor.Search.ObjectField; -#endif // UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS namespace UnityEngine.InputSystem.Editor { @@ -16,14 +12,12 @@ namespace UnityEngine.InputSystem.Editor [CustomPropertyDrawer(typeof(InputActionReference))] internal sealed class InputActionReferencePropertyDrawer : PropertyDrawer { - #if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Custom search providers for asset-based, and project-wide actions input action reference sub-assets. private readonly SearchContext m_Context = UnityEditor.Search.SearchService.CreateContext(new[] { InputActionReferenceSearchProviders.CreateInputActionReferenceSearchProviderForAssets(), InputActionReferenceSearchProviders.CreateInputActionReferenceSearchProviderForProjectWideActions(), }, string.Empty, SearchConstants.PickerSearchFlags); - #endif public void OnGUI(Rect position, SerializedProperty property, GUIContent label, System.Func doField = null) @@ -44,20 +38,12 @@ public void OnGUI(Rect position, SerializedProperty property, GUIContent label, if (currentReference && currentReference.action == null) obj = null; // none/missing - #if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Pick an InputActionReference using custom picker. We need to use this overload taking an object // in order to be in control of the actual assignment to the serialized property so we can substitute. // We allow substituting the object field here to at least enable some test coverage. var candidate = doField != null ? doField(position, obj, typeof(InputActionReference), label) : ObjectField.DoObjectField(position, obj, typeof(InputActionReference), label, m_Context, SearchConstants.PickerViewFlags); - #else - // Before Search API was introduced we need to do this differently to be able to use different - // presentation and modification object as well as to use the same assignment based on a new reference - // object to guarantee that there are no side-effects. - var candidate = doField != null ? doField(position, obj, typeof(InputActionReference), label) - : EditorGUI.ObjectField(position, new GUIContent(label), obj, typeof(InputActionReference), true); - #endif // Only assign the value was actually changed by the user. if (EditorGUI.EndChangeCheck() && !Equals(candidate, current)) diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionReferenceSearchProviders.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionReferenceSearchProviders.cs index e73ad93af4..8b66275e70 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionReferenceSearchProviders.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/PropertyDrawers/InputActionReferenceSearchProviders.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using System.Collections.Generic; using UnityEditor; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/Settings/InputSettingsProvider.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/Settings/InputSettingsProvider.cs index 1b333b0ed4..0706ff005d 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/Settings/InputSettingsProvider.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/Settings/InputSettingsProvider.cs @@ -21,13 +21,7 @@ internal class InputSettingsProvider : SettingsProvider, IDisposable { public const string kEditorBuildSettingsConfigKey = "com.unity.input.settings"; - #if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS - // When Project Wide Actions are enabled we place this as a child node to main settings node. public const string kSettingsPath = InputSettingsPath.kSettingsRootPath + "/Settings"; - #else - // When Project Wide Actions are not enabled we let this be the main settings node. - public const string kSettingsPath = "Project/Input System Package"; - #endif public static void Open() { @@ -39,11 +33,9 @@ public static SettingsProvider CreateInputSettingsProvider() { return new InputSettingsProvider(kSettingsPath, SettingsScope.Project) { - #if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // We put this in a child node called "Settings" when Project-wide Actions is enabled. // When not enabled it sits on the main package Settings node. label = "Settings" - #endif }; } diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/Commands.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/Commands.cs index 113efe6c38..3cfcf2df44 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/Commands.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/Commands.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using System.Collections.Generic; using System.IO; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/ControlSchemeCommands.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/ControlSchemeCommands.cs index 33d186f8a3..6b0ba03687 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/ControlSchemeCommands.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Commands/ControlSchemeCommands.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using System.Collections.Generic; using System.Linq; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorSettingsProvider.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorSettingsProvider.cs index da4ba2e8dd..8c2c922c31 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorSettingsProvider.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorSettingsProvider.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System.Collections.Generic; using System.Threading.Tasks; using UnityEditor; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorState.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorState.cs index 24a0193549..01190a3ad4 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorState.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorState.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using System.Collections.Generic; using System.Linq; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs index 6f08da5045..b25ba17201 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs @@ -1,6 +1,4 @@ -// UITK TreeView is not supported in earlier versions -// Therefore the UITK version of the InputActionAsset Editor is not available on earlier Editor versions either. -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using System.Linq; using UnityEditor; @@ -304,11 +302,11 @@ private InputActionAsset GetEditedAsset() private void Save(bool isAutoSave) { var path = AssetDatabase.GUIDToAssetPath(m_AssetGUID); - #if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS + var projectWideActions = InputSystem.actions; if (projectWideActions != null && path == AssetDatabase.GetAssetPath(projectWideActions)) ProjectWideActionsAsset.Verify(GetEditedAsset()); - #endif + if (InputActionAssetManager.SaveAsset(path, GetEditedAsset().ToJson())) TryUpdateFromAsset(); diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/SerializedInputAction.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/SerializedInputAction.cs index 80d53fa687..125c41a6a8 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/SerializedInputAction.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/SerializedInputAction.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using UnityEditor; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/SerializedInputBinding.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/SerializedInputBinding.cs index a2e7e942b1..16a81f6177 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/SerializedInputBinding.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/SerializedInputBinding.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using System.Linq; using UnityEditor; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/StateContainer.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/StateContainer.cs index c962b71d54..4a2af93675 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/StateContainer.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/StateContainer.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using System.Linq.Expressions; using UnityEditor; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionMapsView.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionMapsView.cs index 7665970d7e..a663a4a81f 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionMapsView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionMapsView.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using CmdEvents = UnityEngine.InputSystem.Editor.InputActionsEditorConstants.CommandEvents; using System.Collections.Generic; using System.Linq; 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 90c2dc0734..89bcf81f3e 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionPropertiesView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionPropertiesView.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using System.Collections.Generic; using System.Linq; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionsTreeView.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionsTreeView.cs index 1c109d0114..f00cff4c0f 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionsTreeView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ActionsTreeView.cs @@ -1,6 +1,4 @@ -// UITK TreeView is not supported in earlier versions -// Therefore the UITK version of the InputActionAsset Editor is not available on earlier Editor versions either. -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using CmdEvents = UnityEngine.InputSystem.Editor.InputActionsEditorConstants.CommandEvents; using System; using System.Collections.Generic; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/BindingPropertiesView.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/BindingPropertiesView.cs index f6fc24561b..1ef2eff60e 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/BindingPropertiesView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/BindingPropertiesView.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System.Linq; using UnityEditor; using UnityEngine.UIElements; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CollectionViewSelectionChangeFilter.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CollectionViewSelectionChangeFilter.cs index 9c7926ec14..aabeef5ee5 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CollectionViewSelectionChangeFilter.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CollectionViewSelectionChangeFilter.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CompositeBindingPropertiesView.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CompositeBindingPropertiesView.cs index ae4517502f..be3d6b9bfc 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CompositeBindingPropertiesView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CompositeBindingPropertiesView.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using System.Collections.Generic; using System.Linq; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CompositePartBindingPropertiesView.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CompositePartBindingPropertiesView.cs index 014acce1f0..ca4bd048f6 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CompositePartBindingPropertiesView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CompositePartBindingPropertiesView.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using System.Collections.Generic; using System.Linq; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ContextMenu.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ContextMenu.cs index d5e61197bc..7859ad745b 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ContextMenu.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ContextMenu.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using System.ComponentModel; using System.Linq; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ControlSchemesView.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ControlSchemesView.cs index f72159f807..9b2057c7ac 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ControlSchemesView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ControlSchemesView.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using System.Collections.Generic; using System.Linq; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CopyPasteHelper.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CopyPasteHelper.cs index 9dfea2c1d6..6b134fc11b 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CopyPasteHelper.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/CopyPasteHelper.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using System.Collections.Generic; using System.Text; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/DropManipulator.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/DropManipulator.cs index 3500aa12dd..7b53afa912 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/DropManipulator.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/DropManipulator.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System.Linq; using UnityEditor; using UnityEngine.UIElements; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionMapsTreeViewItem.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionMapsTreeViewItem.cs index 1313f6682e..31ac505f90 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionMapsTreeViewItem.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionMapsTreeViewItem.cs @@ -1,6 +1,4 @@ -// UITK TreeView is not supported in earlier versions -// Therefore the UITK version of the InputActionAsset Editor is not available on earlier Editor versions either. -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using System.Threading.Tasks; using UnityEditor; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionsEditorView.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionsEditorView.cs index cd9573e1f3..e94e7427f9 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionsEditorView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionsEditorView.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using System.Collections.Generic; using System.Linq; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionsTreeViewItem.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionsTreeViewItem.cs index 53943e7d55..41df8c286d 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionsTreeViewItem.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/InputActionsTreeViewItem.cs @@ -1,6 +1,4 @@ -// UITK TreeView is not supported in earlier versions -// Therefore the UITK version of the InputActionAsset Editor is not available on earlier Editor versions either. -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using System.Threading.Tasks; using UnityEditor; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/MatchingControlPaths.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/MatchingControlPaths.cs index 35c3c0a2c3..d5180ca3bd 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/MatchingControlPaths.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/MatchingControlPaths.cs @@ -37,7 +37,7 @@ public MatchingControlPath(string deviceName, string controlName, bool isRoot) this.children = new List(); } -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR public static List> BuildMatchingControlPathsTreeData(List matchingControlPaths) { int id = 0; 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 6c253c46b4..c0f0bade83 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/NameAndParametersListView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/NameAndParametersListView.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using System.Collections.Generic; using System.Linq; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/PropertiesView.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/PropertiesView.cs index c0d404d558..2165a7e272 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/PropertiesView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/PropertiesView.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using System.Linq; using UnityEditor; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/Selectors.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/Selectors.cs index f2a783f3b8..30fb76edae 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/Selectors.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/Selectors.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using System.Collections.Generic; using System.Linq; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ViewBase.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ViewBase.cs index aef27a6905..d91274c79d 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ViewBase.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/ViewBase.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using System.Collections.Generic; using UnityEngine.UIElements; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/VisualElementExtensions.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/VisualElementExtensions.cs index aac90094bb..2dad46c502 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/VisualElementExtensions.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/Views/VisualElementExtensions.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using UnityEngine.UIElements; diff --git a/Packages/com.unity.inputsystem/InputSystem/InputFeatureNames.cs b/Packages/com.unity.inputsystem/InputSystem/InputFeatureNames.cs index dae497bbe1..3dff3e78a5 100644 --- a/Packages/com.unity.inputsystem/InputSystem/InputFeatureNames.cs +++ b/Packages/com.unity.inputsystem/InputSystem/InputFeatureNames.cs @@ -8,8 +8,6 @@ internal static class InputFeatureNames public const string kUseReadValueCaching = "USE_READ_VALUE_CACHING"; public const string kParanoidReadValueCachingChecks = "PARANOID_READ_VALUE_CACHING_CHECKS"; -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS public const string kUseIMGUIEditorForAssets = "USE_IMGUI_EDITOR_FOR_ASSETS"; -#endif } } diff --git a/Packages/com.unity.inputsystem/InputSystem/InputManager.cs b/Packages/com.unity.inputsystem/InputSystem/InputManager.cs index bd6bf63487..4c8c0e810b 100644 --- a/Packages/com.unity.inputsystem/InputSystem/InputManager.cs +++ b/Packages/com.unity.inputsystem/InputSystem/InputManager.cs @@ -126,7 +126,6 @@ public InputSettings settings } } - #if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS public InputActionAsset actions { get @@ -140,7 +139,6 @@ public InputActionAsset actions ApplyActions(); } } - #endif public InputUpdateType updateMask { @@ -333,13 +331,11 @@ public event Action onSettingsChange remove => m_SettingsChangedListeners.RemoveCallback(value); } - #if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS public event Action onActionsChange { add => m_ActionsChangedListeners.AddCallback(value); remove => m_ActionsChangedListeners.RemoveCallback(value); } - #endif public bool isProcessingEvents => m_InputEventStream.isOpen; @@ -1863,17 +1859,13 @@ internal void Initialize(IInputRuntime runtime, InputSettings settings) m_Settings = settings; -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS InitializeActions(); -#endif // UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS InitializeData(); InstallRuntime(runtime); InstallGlobals(); ApplySettings(); - #if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS ApplyActions(); - #endif } internal void Destroy() @@ -1897,7 +1889,6 @@ internal void Destroy() // Project-wide Actions are never temporary so we do not destroy them. } -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Initialize project-wide actions: // - In editor (edit mode or play-mode) we always use the editor build preferences persisted setting. // - In player build we always attempt to find a preloaded asset. @@ -1919,8 +1910,6 @@ private void InitializeActions() #endif // UNITY_EDITOR } -#endif // UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS - internal void InitializeData() { m_Layouts.Allocate(); @@ -2244,9 +2233,7 @@ internal struct AvailableDevice private CallbackArray m_BeforeUpdateListeners; private CallbackArray m_AfterUpdateListeners; private CallbackArray m_SettingsChangedListeners; - #if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS private CallbackArray m_ActionsChangedListeners; - #endif private bool m_NativeBeforeUpdateHooked; private bool m_HaveDevicesWithStateCallbackReceivers; private bool m_HasFocus; @@ -2302,9 +2289,7 @@ internal bool paranoidReadValueCachingChecksEnabled set => m_ParanoidReadValueCachingChecksEnabled = value; } - #if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS private InputActionAsset m_Actions; - #endif #if UNITY_EDITOR internal IInputDiagnostics m_Diagnostics; @@ -2908,15 +2893,12 @@ internal void ApplySettings() k_InputOnSettingsChangeMarker, "InputSystem.onSettingsChange"); } - #if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS internal void ApplyActions() { // Let listeners know. DelegateHelpers.InvokeCallbacksSafe(ref m_ActionsChangedListeners, k_InputOnActionsChangeMarker, "InputSystem.onActionsChange"); } - #endif - internal unsafe long ExecuteGlobalCommand(ref TCommand command) where TCommand : struct, IInputDeviceCommandInfo { @@ -4174,9 +4156,7 @@ internal SerializedState SaveState() scrollDeltaBehavior = m_ScrollDeltaBehavior, metrics = m_Metrics, settings = m_Settings, - #if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS actions = m_Actions, - #endif #if UNITY_ANALYTICS || UNITY_EDITOR haveSentStartupAnalytics = m_HaveSentStartupAnalytics, @@ -4201,11 +4181,9 @@ internal void RestoreStateWithoutDevices(SerializedState state) settings = state.settings; - #if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Note that we just reassign actions and never destroy them since always mapped to persisted asset // and hence ownership lies with ADB. m_Actions = state.actions; - #endif #if UNITY_ANALYTICS || UNITY_EDITOR m_HaveSentStartupAnalytics = state.haveSentStartupAnalytics; diff --git a/Packages/com.unity.inputsystem/InputSystem/InputSettings.cs b/Packages/com.unity.inputsystem/InputSystem/InputSettings.cs index bed8bddbc3..a423c88084 100644 --- a/Packages/com.unity.inputsystem/InputSystem/InputSettings.cs +++ b/Packages/com.unity.inputsystem/InputSystem/InputSettings.cs @@ -978,7 +978,7 @@ public enum InputActionPropertyDrawerMode MultilineBoth, } -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR /// /// Determines if we should render the UI with IMGUI even if an UI Toolkit UI is available. /// @@ -1059,11 +1059,7 @@ internal static bool AreEqual(InputSettings a, InputSettings b) CompareFeatureFlag(a, b, InputFeatureNames.kParanoidReadValueCachingChecks) && CompareFeatureFlag(a, b, InputFeatureNames.kDisableUnityRemoteSupport) && CompareFeatureFlag(a, b, InputFeatureNames.kRunPlayerUpdatesInEditMode) && -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS CompareFeatureFlag(a, b, InputFeatureNames.kUseIMGUIEditorForAssets); -#else - true; // Improves formatting -#endif } } } diff --git a/Packages/com.unity.inputsystem/InputSystem/InputSystem.cs b/Packages/com.unity.inputsystem/InputSystem/InputSystem.cs index 444d27ec4d..5608b366de 100644 --- a/Packages/com.unity.inputsystem/InputSystem/InputSystem.cs +++ b/Packages/com.unity.inputsystem/InputSystem/InputSystem.cs @@ -3014,7 +3014,6 @@ internal static bool ShouldDrawWarningIconForBinding(string bindingPath) #region Actions -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // This is called from InitializeInEditor() and InitializeInPlayer() to make sure // project-wide actions are all active in they are active in all of these MonoBehavior methods: @@ -3133,7 +3132,6 @@ public static event Action onActionsChange remove => s_Manager.onActionsChange -= value; } -#endif // UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS /// /// Event that is signalled when the state of enabled actions in the system changes or @@ -3579,12 +3577,10 @@ internal static void InitializeInEditor(IInputRuntime runtime = null) s_Manager.ApplySettings(); } - #if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // See if we have a saved actions object var savedActions = ProjectWideActionsBuildProvider.actionsToIncludeInPlayerBuild; if (savedActions != null) s_Manager.actions = savedActions; - #endif // UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS InputEditorUserSettings.Load(); @@ -3654,9 +3650,7 @@ internal static void OnPlayModeChange(PlayModeStateChange change) ////REVIEW: is there any other cleanup work we want to before? should we automatically nuke //// InputDevices that have been created with AddDevice<> during play mode? case PlayModeStateChange.EnteredEditMode: -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS DisableActions(false); -#endif // Nuke all InputUsers. InputUser.ResetGlobals(); @@ -3768,10 +3762,8 @@ private static void InitializeInPlayer(IInputRuntime runtime = null, InputSettin SetUpRemoting(); #endif -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // && !UNITY_INCLUDE_TESTS // This is the point where we initialise project-wide actions for the Player EnableActions(); -#endif } #endif // UNITY_EDITOR @@ -3859,14 +3851,12 @@ private static void Reset(bool enableRemoting = false, IInputRuntime runtime = n { k_InputResetMarker.Begin(); -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Note that in a test setup we might enter reset with project-wide actions already enabled but the // reset itself has pushed the action system state on the state stack. To avoid action state memory // problems we disable actions here and also request asset to be marked dirty and reimported. DisableActions(triggerSetupChanged: true); if (s_Manager != null) s_Manager.actions = null; -#endif // UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Some devices keep globals. Get rid of them by pretending the devices // are removed. @@ -3912,9 +3902,7 @@ private static void Reset(bool enableRemoting = false, IInputRuntime runtime = n EnhancedTouchSupport.Reset(); // This is the point where we initialise project-wide actions for the Editor Play-mode, Editor Tests and Player Tests. - #if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS EnableActions(); - #endif k_InputResetMarker.End(); } diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInput.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInput.cs index 32ca9992e3..5471fdec38 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInput.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInput.cs @@ -1794,7 +1794,7 @@ private void AssignPlayerIndex() } } - #if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS + #if UNITY_EDITOR void Reset() { // Set default actions to project wide actions. diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs index cb5d9c89c8..197d96cbc4 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/PlayerInput/PlayerInputEditor.cs @@ -81,7 +81,6 @@ public override void OnInspectorGUI() EditorGUILayout.PropertyField(m_ActionsProperty); var actionsWereChanged = false; -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Check for if we're using project-wide actions to raise a warning message. if (m_ActionsProperty.objectReferenceValue != null) { @@ -95,7 +94,7 @@ public override void OnInspectorGUI() MessageType.Warning); } } -#endif + var assetChanged = CheckIfActionAssetChanged(); // initialize the editor component if the asset has changed or if it has not been initialized yet if (EditorGUI.EndChangeCheck() || !m_ActionAssetInitialized || assetChanged || m_ActionAssetInstanceID == 0) diff --git a/Packages/com.unity.inputsystem/InputSystem/Unity.InputSystem.asmdef b/Packages/com.unity.inputsystem/InputSystem/Unity.InputSystem.asmdef index bd5b6f0af4..77c58fb2e0 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Unity.InputSystem.asmdef +++ b/Packages/com.unity.inputsystem/InputSystem/Unity.InputSystem.asmdef @@ -67,11 +67,6 @@ "expression": "2022.2", "define": "HAS_SET_LOCAL_POSITION_AND_ROTATION" }, - { - "name": "Unity", - "expression": "2022.3", - "define": "UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS" - }, { "name": "Unity", "expression": "1", From 1db2b4ac69621789e8ee6e03f693dba8c71e081f Mon Sep 17 00:00:00 2001 From: Anthony Yakovlev Date: Wed, 5 Nov 2025 16:29:54 +0300 Subject: [PATCH 2/6] this class is not used --- .../UITKAssetEditor/InputActionsEditorWindow.cs | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs index b25ba17201..ce0ad25ff4 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs @@ -1,24 +1,12 @@ #if UNITY_EDITOR using System; -using System.Linq; using UnityEditor; using UnityEditor.Callbacks; -using UnityEditor.PackageManager.UI; using UnityEditor.ShortcutManagement; using UnityEngine.UIElements; -using UnityEditor.UIElements; namespace UnityEngine.InputSystem.Editor { - // TODO: Remove when UIToolkit editor is complete and set as the default editor - [InitializeOnLoad] - internal static class EnableUITKEditor - { - static EnableUITKEditor() - { - } - } - internal class InputActionsEditorWindow : EditorWindow, IInputActionAssetEditor { // Register editor type via static constructor to enable asset monitoring From 0aceaabad9249e38903834ce3ab4b2251f9463f3 Mon Sep 17 00:00:00 2001 From: Anthony Yakovlev Date: Wed, 5 Nov 2025 16:42:02 +0300 Subject: [PATCH 3/6] remove the project-wide actions define from tests and the main project as well --- .../CustomComposite/CustomComposite.cs | 3 -- .../ProjectWideActions.asmdef | 8 +---- .../ProjectWideActionsExample.cs | 5 +--- .../ControlSchemeEditorTests.cs | 4 +-- .../CustomProcessorEnumTest.cs | 2 +- ...ctionReferencePropertyDrawerEditorTests.cs | 4 --- .../InputActionsEditorTests.cs | 4 +-- .../ProjectWideInputActionsEditorTests.cs | 4 --- .../InputSystem.Editor/SelectorsTests.cs | 4 +-- Assets/Tests/InputSystem.Editor/TestData.cs | 2 -- .../InputSystem.Editor/TestDataGenerators.cs | 2 -- .../UIToolkitBaseTestWindow.cs | 2 +- .../Unity.InputSystem.Tests.Editor.asmdef | 8 +---- .../Tests/InputSystem/CorePerformanceTests.cs | 4 --- Assets/Tests/InputSystem/CoreTests_Actions.cs | 30 ------------------- .../CoreTests_Actions_Interactions.cs | 2 -- .../Tests/InputSystem/CoreTests_Analytics.cs | 18 ----------- .../Tests/InputSystem/CoreTests_Controls.cs | 2 -- Assets/Tests/InputSystem/CoreTests_Devices.cs | 2 -- Assets/Tests/InputSystem/CoreTests_Editor.cs | 7 ----- .../CoreTests_ProjectWideActions.cs | 4 --- .../Unity.InputSystem.Tests.asmdef | 5 ---- 22 files changed, 8 insertions(+), 118 deletions(-) diff --git a/Assets/Samples/CustomComposite/CustomComposite.cs b/Assets/Samples/CustomComposite/CustomComposite.cs index 4a19e7fbf2..273a54f4cd 100644 --- a/Assets/Samples/CustomComposite/CustomComposite.cs +++ b/Assets/Samples/CustomComposite/CustomComposite.cs @@ -145,7 +145,6 @@ public override void OnGUI() target.scaleFactor = EditorGUILayout.Slider(m_ScaleFactorLabel, currentValue, 0, 2); } -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS public override void OnDrawVisualElements(VisualElement root, Action onChangedCallback) { var slider = new Slider(m_ScaleFactorLabel.text, 0, 2) @@ -167,8 +166,6 @@ public override void OnDrawVisualElements(VisualElement root, Action onChangedCa root.Add(slider); } -#endif - private GUIContent m_ScaleFactorLabel = new GUIContent("Scale Factor"); } #endif diff --git a/Assets/Samples/ProjectWideActions/ProjectWideActions.asmdef b/Assets/Samples/ProjectWideActions/ProjectWideActions.asmdef index 22d4e9555f..cc6ae12bcd 100644 --- a/Assets/Samples/ProjectWideActions/ProjectWideActions.asmdef +++ b/Assets/Samples/ProjectWideActions/ProjectWideActions.asmdef @@ -11,12 +11,6 @@ "precompiledReferences": [], "autoReferenced": true, "defineConstraints": [], - "versionDefines": [ - { - "name": "Unity", - "expression": "2022.3", - "define": "UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS" - } - ], + "versionDefines": [], "noEngineReferences": false } \ No newline at end of file diff --git a/Assets/Samples/ProjectWideActions/ProjectWideActionsExample.cs b/Assets/Samples/ProjectWideActions/ProjectWideActionsExample.cs index 9279316ede..8c5377affd 100644 --- a/Assets/Samples/ProjectWideActions/ProjectWideActionsExample.cs +++ b/Assets/Samples/ProjectWideActions/ProjectWideActionsExample.cs @@ -1,4 +1,3 @@ -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS namespace UnityEngine.InputSystem.Samples.ProjectWideActions { @@ -75,6 +74,4 @@ void Update() } } } // class ProjectWideActionsExample -} // namespace UnityEngine.InputSystem.Samples.ProjectWideActions - -#endif +} // namespace UnityEngine.InputSystem.Samples.ProjectWideActions \ No newline at end of file diff --git a/Assets/Tests/InputSystem.Editor/ControlSchemeEditorTests.cs b/Assets/Tests/InputSystem.Editor/ControlSchemeEditorTests.cs index a90fedf61f..377b79ff8e 100644 --- a/Assets/Tests/InputSystem.Editor/ControlSchemeEditorTests.cs +++ b/Assets/Tests/InputSystem.Editor/ControlSchemeEditorTests.cs @@ -1,4 +1,3 @@ -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS using NUnit.Framework; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Editor; @@ -404,5 +403,4 @@ public void ChangeBindingsControlSchemesCommand_CanRemoveControlSchemes() Assert.That(groupsProperty.stringValue, Is.EqualTo(string.Empty)); } -} -#endif +} \ No newline at end of file diff --git a/Assets/Tests/InputSystem.Editor/CustomProcessorEnumTest.cs b/Assets/Tests/InputSystem.Editor/CustomProcessorEnumTest.cs index 08865b9417..9663c38f27 100644 --- a/Assets/Tests/InputSystem.Editor/CustomProcessorEnumTest.cs +++ b/Assets/Tests/InputSystem.Editor/CustomProcessorEnumTest.cs @@ -1,4 +1,4 @@ -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS && UNITY_6000_0_OR_NEWER +#if UNITY_EDITOR && UNITY_6000_0_OR_NEWER using System; using NUnit.Framework; diff --git a/Assets/Tests/InputSystem.Editor/InputActionReferencePropertyDrawerEditorTests.cs b/Assets/Tests/InputSystem.Editor/InputActionReferencePropertyDrawerEditorTests.cs index 4a976a776f..1db8de7dc0 100644 --- a/Assets/Tests/InputSystem.Editor/InputActionReferencePropertyDrawerEditorTests.cs +++ b/Assets/Tests/InputSystem.Editor/InputActionReferencePropertyDrawerEditorTests.cs @@ -1,5 +1,3 @@ -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Mimic implementation guard - using System; using System.Collections; using NUnit.Framework; @@ -168,5 +166,3 @@ public IEnumerator FieldObjectIsNullWhenReferenceIsInvalid() Assert.That(fieldObj, Is.Null); } } - -#endif // UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS diff --git a/Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs b/Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs index 03521103e9..5d31d5e306 100644 --- a/Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs +++ b/Assets/Tests/InputSystem.Editor/InputActionsEditorTests.cs @@ -1,6 +1,4 @@ -// UITK TreeView is not supported in earlier versions -// Therefore the UITK version of the InputActionAsset Editor is not available on earlier Editor versions either. -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS && UNITY_6000_0_OR_NEWER +#if UNITY_EDITOR && UNITY_6000_0_OR_NEWER using NUnit.Framework; using System; diff --git a/Assets/Tests/InputSystem.Editor/ProjectWideInputActionsEditorTests.cs b/Assets/Tests/InputSystem.Editor/ProjectWideInputActionsEditorTests.cs index 30690878b2..969e1bb92f 100644 --- a/Assets/Tests/InputSystem.Editor/ProjectWideInputActionsEditorTests.cs +++ b/Assets/Tests/InputSystem.Editor/ProjectWideInputActionsEditorTests.cs @@ -1,5 +1,3 @@ -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS - using System; using System.Collections.Generic; using System.IO; @@ -496,5 +494,3 @@ public void ProjectWideActions_CanBeAssignedAndFiresCallbackWhenAssignedAndDiffe Assert.That(m_CallbackCount, Is.EqualTo(2)); } } - -#endif diff --git a/Assets/Tests/InputSystem.Editor/SelectorsTests.cs b/Assets/Tests/InputSystem.Editor/SelectorsTests.cs index 978fc55b2b..a304952189 100644 --- a/Assets/Tests/InputSystem.Editor/SelectorsTests.cs +++ b/Assets/Tests/InputSystem.Editor/SelectorsTests.cs @@ -1,6 +1,4 @@ -// UITK TreeView is not supported in earlier versions -// Therefore the UITK version of the InputActionAsset Editor is not available on earlier Editor versions either. -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS +#if UNITY_EDITOR using System; using System.Collections.Generic; using System.Linq; diff --git a/Assets/Tests/InputSystem.Editor/TestData.cs b/Assets/Tests/InputSystem.Editor/TestData.cs index 9571632ef4..fe477720e7 100644 --- a/Assets/Tests/InputSystem.Editor/TestData.cs +++ b/Assets/Tests/InputSystem.Editor/TestData.cs @@ -1,4 +1,3 @@ -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS using System.Collections.Generic; using UnityEditor; using UnityEngine; @@ -71,4 +70,3 @@ public static Generator> N(Generator generator, int count) }); } } -#endif diff --git a/Assets/Tests/InputSystem.Editor/TestDataGenerators.cs b/Assets/Tests/InputSystem.Editor/TestDataGenerators.cs index ae53e4b49c..6e28e5eeb4 100644 --- a/Assets/Tests/InputSystem.Editor/TestDataGenerators.cs +++ b/Assets/Tests/InputSystem.Editor/TestDataGenerators.cs @@ -1,4 +1,3 @@ -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS using System.Collections.Generic; using UnityEngine.InputSystem; @@ -65,4 +64,3 @@ public static InputControlScheme WithName(this InputControlScheme controlScheme, return new InputControlScheme(name, controlScheme.deviceRequirements, controlScheme.bindingGroup); } } -#endif diff --git a/Assets/Tests/InputSystem.Editor/UIToolkitBaseTestWindow.cs b/Assets/Tests/InputSystem.Editor/UIToolkitBaseTestWindow.cs index 1b320ffeb2..eb437dbcc6 100644 --- a/Assets/Tests/InputSystem.Editor/UIToolkitBaseTestWindow.cs +++ b/Assets/Tests/InputSystem.Editor/UIToolkitBaseTestWindow.cs @@ -1,6 +1,6 @@ // UITK TreeView is not supported in earlier versions // Therefore the UITK version of the InputActionAsset Editor is not available on earlier Editor versions either. -#if UNITY_EDITOR && UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS && UNITY_6000_0_OR_NEWER +#if UNITY_EDITOR && UNITY_6000_0_OR_NEWER using NUnit.Framework; using System; diff --git a/Assets/Tests/InputSystem.Editor/Unity.InputSystem.Tests.Editor.asmdef b/Assets/Tests/InputSystem.Editor/Unity.InputSystem.Tests.Editor.asmdef index 0ddc350ce0..7c2df40249 100644 --- a/Assets/Tests/InputSystem.Editor/Unity.InputSystem.Tests.Editor.asmdef +++ b/Assets/Tests/InputSystem.Editor/Unity.InputSystem.Tests.Editor.asmdef @@ -21,12 +21,6 @@ "defineConstraints": [ "UNITY_INCLUDE_TESTS" ], - "versionDefines": [ - { - "name": "Unity", - "expression": "2022.3", - "define": "UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS" - } - ], + "versionDefines": [], "noEngineReferences": false } \ No newline at end of file diff --git a/Assets/Tests/InputSystem/CorePerformanceTests.cs b/Assets/Tests/InputSystem/CorePerformanceTests.cs index 65874f9dc7..112c45951c 100644 --- a/Assets/Tests/InputSystem/CorePerformanceTests.cs +++ b/Assets/Tests/InputSystem/CorePerformanceTests.cs @@ -999,10 +999,8 @@ public void Performance_OptimizedControls_EvaluateStaleControlReadsWhenGamepadSt var gamepad = InputSystem.AddDevice(); -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Disable the project wide actions actions to avoid performance impact. InputSystem.actions?.Disable(); -#endif Measure.Method(() => { @@ -1041,10 +1039,8 @@ public void Performance_OptimizedControls_EvaluateStaleControlReadsWhenGamepadSt .Run(); -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Re-enable the project wide actions actions. InputSystem.actions?.Enable(); -#endif return; void MethodToMeasure(Gamepad g) diff --git a/Assets/Tests/InputSystem/CoreTests_Actions.cs b/Assets/Tests/InputSystem/CoreTests_Actions.cs index 3a3ee6d57a..1bbb61f56d 100644 --- a/Assets/Tests/InputSystem/CoreTests_Actions.cs +++ b/Assets/Tests/InputSystem/CoreTests_Actions.cs @@ -35,9 +35,7 @@ partial class CoreTests [TestCase(InputFeatureNames.kParanoidReadValueCachingChecks)] [TestCase(InputFeatureNames.kDisableUnityRemoteSupport)] [TestCase(InputFeatureNames.kRunPlayerUpdatesInEditMode)] - #if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS [TestCase(InputFeatureNames.kUseIMGUIEditorForAssets)] - #endif public void Settings_ShouldStoreSettingsAndFeatureFlags(string featureName) { using (var settings = Scoped.Object(InputSettings.CreateInstance())) @@ -713,10 +711,8 @@ public void Actions_CanTargetMultipleControls() [Category("Actions")] public void Actions_CanTargetSameControlWithMultipleActions() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Exclude project-wide actions from this test InputSystem.actions?.Disable(); // Prevent these actions appearing in the `InputActionTrace` -#endif var gamepad = InputSystem.AddDevice(); @@ -3681,10 +3677,8 @@ public void Actions_CanCreateActionsWithoutAnActionMap() [Category("Actions")] public void Actions_CanCreateActionAssetWithMultipleActionMaps() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Exclude project-wide actions from this test InputSystem.actions?.Disable(); // Prevent these actions appearing in the `InputActionTrace` -#endif var asset = ScriptableObject.CreateInstance(); @@ -3935,10 +3929,8 @@ public void Actions_CanByPassControlActuationChecks_UsingPasshtroughAction() [Category("Actions")] public void Actions_WithMultipleBoundControls_DriveInteractionsFromControlWithGreatestActuation() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Exclude project-wide actions from this test InputSystem.actions?.Disable(); // Prevent these actions appearing in the `InputActionTrace` -#endif var gamepad = InputSystem.AddDevice(); @@ -4227,10 +4219,8 @@ public void Actions_WithMultipleBoundControls_ProcessesInteractionsOnAllActiveBi [Category("Actions")] public void Actions_WithMultipleBoundControls_CanHandleInteractionsThatTriggerOnlyOnButtonRelease() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Exclude project-wide actions from this test InputSystem.actions?.Disable(); // Prevent these actions appearing in the `InputActionTrace` -#endif var keyboard = InputSystem.AddDevice(); var gamepad = InputSystem.AddDevice(); @@ -4762,10 +4752,8 @@ public void Actions_CanRecordActions_AndReadValueAsObject() [Category("Actions")] public void Actions_CanRecordAllActionsInTheSystem() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Exclude project-wide actions from this test InputSystem.actions?.Disable(); // Prevent these actions appearing in the `InputActionTrace` -#endif var gamepad = InputSystem.AddDevice(); @@ -5289,10 +5277,8 @@ public void Actions_NameInJsonIsSetToEmptyString_IfCreatedFromObjectWithNullName [Category("Actions")] public void Actions_CanQueryAllEnabledActions() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Exclude project-wide actions from this test InputSystem.actions?.Disable(); // Remove from `ListEnabledActions` -#endif var action = new InputAction(binding: "/leftStick"); action.Enable(); @@ -5566,11 +5552,9 @@ private InputActionMap CreateSingletonAction() [TestCaseSource(typeof(ModificationCases))] public void Actions_CanHandleModification(Modification modification, IInputActionCollection2 actions) { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Exclude project-wide actions from this test InputSystem.actions?.Disable(); InputActionState.DestroyAllActionMapStates(); // Required for `onActionChange` to report correct number of changes -#endif var gamepad = InputSystem.AddDevice(); @@ -6458,11 +6442,9 @@ public void Actions_WhenDeviceIsRemoved_ReadingValueInActionListenersWillNotThro [Category("Actions")] public void Actions_WhenDeviceIsRemoved_DeviceIsRemovedFromDeviceMask() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Exclude project-wide actions from this test InputSystem.actions?.Disable(); InputActionState.DestroyAllActionMapStates(); // Required for `onActionChange` to report correct number of changes -#endif var gamepad = InputSystem.AddDevice(); @@ -6606,11 +6588,9 @@ public void Actions_ControlsUpdate_WhenDeviceConfigurationChanges_AndControlIsNo [Category("Actions")] public void Actions_WhenControlsUpdate_NotificationIsTriggered_ButOnlyAfterBindingsHaveFirstBeenResolved() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Exclude project-wide actions from this test InputSystem.actions?.Disable(); InputActionState.DestroyAllActionMapStates(); // Required for `onActionChange` to report correct number of changes - #endif var enabledAction = new InputAction("enabledAction", binding: "/leftTrigger"); @@ -6668,11 +6648,9 @@ public void Actions_WhenControlsUpdate_NotificationIsTriggered_ButOnlyAfterBindi [Category("Actions")] public void Actions_WhenControlsUpdateInActionMap_NotificationIsTriggered() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Exclude project-wide actions from this test InputSystem.actions?.Disable(); InputActionState.DestroyAllActionMapStates(); // Required for `onActionChange` to report correct number of changes -#endif var actionMap = new InputActionMap("map"); actionMap.AddAction("action", binding: "/leftTrigger"); @@ -6700,11 +6678,9 @@ public void Actions_WhenControlsUpdateInActionMap_NotificationIsTriggered() [Category("Actions")] public void Actions_WhenControlsUpdateInActionAsset_NotificationIsTriggered() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Exclude project-wide actions from this test InputSystem.actions?.Disable(); InputActionState.DestroyAllActionMapStates(); // Required for `onActionChange` to report correct number of changes -#endif var asset = ScriptableObject.CreateInstance(); asset.name = "asset"; @@ -6890,10 +6866,8 @@ public void Actions_WhenInProgress_AddingAndRemovingUnusedDevice_DoesNotAffectAc [Category("Actions")] public void Actions_CanFindEnabledActions() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Exclude project-wide actions from this test InputSystem.actions?.Disable(); // Remove from `ListEnabledActions` -#endif var action1 = new InputAction(name: "a"); var action2 = new InputAction(name: "b"); @@ -11872,10 +11846,8 @@ public void Actions_CanIterateOverActionsInMap() [Category("Actions")] public void Actions_CanUseTouchWithActions() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Exclude project-wide actions from this test InputSystem.actions?.Disable(); // Prevent these actions appearing in the `InputActionTrace` -#endif var touchscreen = InputSystem.AddDevice(); @@ -11947,10 +11919,8 @@ public void Actions_CanUseTouchWithActions() [Category("Actions")] public void Actions_CanDrivePointerInputFromTouchPenAndMouse() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Exclude project-wide actions from this test InputSystem.actions?.Disable(); // Prevent these actions appearing in the `InputActionTrace` -#endif // Give us known parameters for tap detection. InputSystem.settings.defaultTapTime = 0.5f; diff --git a/Assets/Tests/InputSystem/CoreTests_Actions_Interactions.cs b/Assets/Tests/InputSystem/CoreTests_Actions_Interactions.cs index fb421b3e81..810284d416 100644 --- a/Assets/Tests/InputSystem/CoreTests_Actions_Interactions.cs +++ b/Assets/Tests/InputSystem/CoreTests_Actions_Interactions.cs @@ -865,10 +865,8 @@ public void Actions_CanPerformDoubleTapInteraction() [Category("Actions")] public void Actions_CanCustomizeButtonPressPointsOfInteractions() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Exclude project-wide actions from this test InputSystem.actions?.Disable(); // Prevent these actions appearing in the `InputActionTrace` -#endif var gamepad = InputSystem.AddDevice(); diff --git a/Assets/Tests/InputSystem/CoreTests_Analytics.cs b/Assets/Tests/InputSystem/CoreTests_Analytics.cs index e9892b3064..2a156dfb35 100644 --- a/Assets/Tests/InputSystem/CoreTests_Analytics.cs +++ b/Assets/Tests/InputSystem/CoreTests_Analytics.cs @@ -429,11 +429,7 @@ public void Analytics_ShouldReportBuildAnalytics_WhenNotHavingSettingsAsset() // Assert: Data content var data = (InputBuildAnalytic.InputBuildAnalyticData)sentAnalyticsEvents[0].data; Assert.That(data.build_guid, Is.EqualTo(string.Empty)); -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS Assert.That(data.has_projectwide_input_action_asset, Is.EqualTo(InputSystem.actions != null)); -#else - Assert.That(data.has_projectwide_input_action_asset, Is.False); -#endif Assert.That(data.has_settings_asset, Is.False); Assert.That(data.has_default_settings, Is.True); @@ -462,11 +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))); -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS Assert.That(data.feature_use_imgui_editor_for_assets, Is.EqualTo(defaultSettings.IsFeatureEnabled(InputFeatureNames.kUseIMGUIEditorForAssets))); -#else - Assert.That(data.feature_use_imgui_editor_for_assets, Is.False); -#endif } finally { @@ -515,9 +507,7 @@ public void Analytics_ShouldReportBuildAnalytics_WhenHavingSettingsAssetWithCust customSettings.SetInternalFeatureFlag(InputFeatureNames.kParanoidReadValueCachingChecks, true); customSettings.SetInternalFeatureFlag(InputFeatureNames.kDisableUnityRemoteSupport, true); customSettings.SetInternalFeatureFlag(InputFeatureNames.kRunPlayerUpdatesInEditMode, true); -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS customSettings.SetInternalFeatureFlag(InputFeatureNames.kUseIMGUIEditorForAssets, true); -#endif customSettings.SetInternalFeatureFlag(InputFeatureNames.kUseReadValueCaching, true); InputSystem.settings = customSettings; @@ -535,11 +525,7 @@ public void Analytics_ShouldReportBuildAnalytics_WhenHavingSettingsAssetWithCust var data = (InputBuildAnalytic.InputBuildAnalyticData)sentAnalyticsEvents[0].data; Assert.That(data.build_guid, Is.EqualTo(string.Empty)); -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS Assert.That(data.has_projectwide_input_action_asset, Is.EqualTo(InputSystem.actions != null)); -#else - Assert.That(data.has_projectwide_input_action_asset, Is.False); -#endif Assert.That(data.has_settings_asset, Is.False); // Note: We just don't write any file in this test, hence false Assert.That(data.has_default_settings, Is.False); @@ -568,11 +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); -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS Assert.That(data.feature_use_imgui_editor_for_assets, Is.True); -#else - Assert.That(data.feature_use_imgui_editor_for_assets, Is.False); // No impact -#endif } finally { diff --git a/Assets/Tests/InputSystem/CoreTests_Controls.cs b/Assets/Tests/InputSystem/CoreTests_Controls.cs index be5f459c45..61051d802f 100644 --- a/Assets/Tests/InputSystem/CoreTests_Controls.cs +++ b/Assets/Tests/InputSystem/CoreTests_Controls.cs @@ -480,7 +480,6 @@ public unsafe void Controls_ValueIsReadFromStateMemoryOnlyWhenControlHasBeenMark // This doesn't apply to this test, but just in case it gets edited/duplicated in future... public void Controls_ValueCachingWorksAcrossEntireDeviceMemoryRange() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Exclude project-wide actions from this test // The presence of any enabled actions means we have installed StateChangeMonitors // which interferes with this test. Essentially when we update the device state @@ -488,7 +487,6 @@ public void Controls_ValueCachingWorksAcrossEntireDeviceMemoryRange() // call NotifyControlStateChanged for each of the actions which _may_ cause a Read() // on the control and make it immediately cached (non-stale) again. InputSystem.actions?.Disable(); -#endif var keyboard = InputSystem.AddDevice(); diff --git a/Assets/Tests/InputSystem/CoreTests_Devices.cs b/Assets/Tests/InputSystem/CoreTests_Devices.cs index af4d28cd79..580352dad2 100644 --- a/Assets/Tests/InputSystem/CoreTests_Devices.cs +++ b/Assets/Tests/InputSystem/CoreTests_Devices.cs @@ -4137,12 +4137,10 @@ public void Devices_RemovingDevice_CleansUpUpdateCallback() [Retry(2)] // Warm up JIT public void Devices_RemovingAndReaddingDevice_DoesNotAllocateMemory() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // Exclude project-wide actions from this test // Prevent GC Allocations happening later in test InputSystem.actions?.Disable(); InputActionState.DestroyAllActionMapStates(); -#endif var description = new InputDeviceDescription diff --git a/Assets/Tests/InputSystem/CoreTests_Editor.cs b/Assets/Tests/InputSystem/CoreTests_Editor.cs index 27302b5572..273d9b1bda 100644 --- a/Assets/Tests/InputSystem/CoreTests_Editor.cs +++ b/Assets/Tests/InputSystem/CoreTests_Editor.cs @@ -2892,7 +2892,6 @@ public void Editor_WhenRunUpdatesInEditModeIsEnabled_InputActionsTriggerInEditMo private static void DisableProjectWideActions() { -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS // If the system has project-wide input actions they will start enabled once InputSystem.Reset() is called and // be disabled entering EditMode. Hence, we adjust extra variable to compensate ofstate allocated by // project-wide actions. @@ -2902,14 +2901,12 @@ private static void DisableProjectWideActions() InputSystem.actions.Disable(); InputActionState.DestroyAllActionMapStates(); } -#endif } [Test] [Category("Editor")] public void Editor_InitializeInEditor_EnablesProjectWideActions() { - #if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS if (InputSystem.actions != null) { // Asserts that project wide actions are enabled by default. @@ -2935,7 +2932,6 @@ public void Editor_InitializeInEditor_EnablesProjectWideActions() Assert.That(InputSystem.actions.enabled, Is.False); } - #endif } [Test] @@ -2952,13 +2948,10 @@ public void Editor_LeavingPlayMode_DestroysAllActionStates() // Enter play mode. InputSystem.OnPlayModeChange(PlayModeStateChange.ExitingEditMode); -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS - // This simulates enabling project-wide actions, which is done before just before entering play mode, // called from InputSystem.InitializeInEditor(). if (InputSystem.actions) InputSystem.actions.Enable(); -#endif InputSystem.OnPlayModeChange(PlayModeStateChange.EnteredPlayMode); diff --git a/Assets/Tests/InputSystem/CoreTests_ProjectWideActions.cs b/Assets/Tests/InputSystem/CoreTests_ProjectWideActions.cs index 4d9263696f..6b704cbfe5 100644 --- a/Assets/Tests/InputSystem/CoreTests_ProjectWideActions.cs +++ b/Assets/Tests/InputSystem/CoreTests_ProjectWideActions.cs @@ -1,5 +1,3 @@ -#if UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS - using System; using NUnit.Framework; using UnityEngine.InputSystem; @@ -197,5 +195,3 @@ public void ProjectWideActions_CanEnableCurrentActionMapOfPlayerInput(string act Assert.That(playerInput.actions.enabled, Is.EqualTo(expectedResult)); } } - -#endif diff --git a/Assets/Tests/InputSystem/Unity.InputSystem.Tests.asmdef b/Assets/Tests/InputSystem/Unity.InputSystem.Tests.asmdef index c94081da4d..6510b4106f 100644 --- a/Assets/Tests/InputSystem/Unity.InputSystem.Tests.asmdef +++ b/Assets/Tests/InputSystem/Unity.InputSystem.Tests.asmdef @@ -36,11 +36,6 @@ "expression": "2022.1", "define": "TEMP_DISABLE_STANDALONE_OSX_XINPUT_TEST" }, - { - "name": "Unity", - "expression": "2022.3", - "define": "UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS" - }, { "name": "Unity", "expression": "6000.0.9", From aff3ee6ac9a5ad55033acd2f93ef092792dce6e9 Mon Sep 17 00:00:00 2001 From: Anthony Yakovlev Date: Tue, 11 Nov 2025 14:55:02 +0300 Subject: [PATCH 4/6] remove imgui-based InputActionEditorWindow --- .../AssetEditor/InputActionEditorToolbar.cs | 674 -------------- .../InputActionEditorToolbar.cs.meta | 11 - .../AssetEditor/InputActionEditorWindow.cs | 843 ------------------ .../InputActionEditorWindow.cs.meta | 11 - .../InputActionImporterEditor.cs | 6 +- 5 files changed, 1 insertion(+), 1544 deletions(-) delete mode 100644 Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorToolbar.cs delete mode 100644 Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorToolbar.cs.meta delete mode 100644 Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs delete mode 100644 Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs.meta diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorToolbar.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorToolbar.cs deleted file mode 100644 index b43b764387..0000000000 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorToolbar.cs +++ /dev/null @@ -1,674 +0,0 @@ -#if UNITY_EDITOR -using System; -using System.Collections.Generic; -using System.Linq; -using UnityEditor; -using UnityEditor.IMGUI.Controls; -using UnityEditorInternal; -using UnityEngine.InputSystem.Utilities; - -////TODO: better method for creating display names than InputControlPath.TryGetDeviceLayout - -////FIXME: Device requirements list in control scheme popup must mention explicitly that that is what it is - -namespace UnityEngine.InputSystem.Editor -{ - /// - /// Toolbar in input action asset editor. - /// - /// - /// Allows editing and selecting from the set of control schemes as well as selecting from the - /// set of device requirements within the currently selected control scheme. - /// - /// Also controls saving and has the global search text field. - /// - /// - [Serializable] - internal class InputActionEditorToolbar - { - public void OnGUI() - { - EditorGUILayout.BeginHorizontal(EditorStyles.toolbar); - DrawSchemeSelection(); - DrawDeviceFilterSelection(); - if (!InputEditorUserSettings.autoSaveInputActionAssets) - DrawSaveButton(); - GUILayout.FlexibleSpace(); - DrawAutoSaveToggle(); - GUILayout.Space(5); - DrawSearchField(); - GUILayout.Space(5); - EditorGUILayout.EndHorizontal(); - } - - private void DrawSchemeSelection() - { - var buttonGUI = m_ControlSchemes.LengthSafe() > 0 - ? new GUIContent(selectedControlScheme?.name ?? "All Control Schemes") - : new GUIContent("No Control Schemes"); - - var buttonRect = GUILayoutUtility.GetRect(buttonGUI, EditorStyles.toolbarPopup, GUILayout.MinWidth(k_MinimumButtonWidth)); - - if (GUI.Button(buttonRect, buttonGUI, EditorStyles.toolbarPopup)) - { - // PopupWindow.Show already takes the current OnGUI EditorWindow context into account for window coordinates. - // However, on macOS, menu commands are performed asynchronously, so we don't have a current OnGUI context. - // So in that case, we need to translate the rect to screen coordinates. Don't do that on windows, as we will - // overcompensate otherwise. - if (Application.platform == RuntimePlatform.OSXEditor) - buttonRect = new Rect(EditorGUIUtility.GUIToScreenPoint(new Vector2(buttonRect.x, buttonRect.y)), Vector2.zero); - - var menu = new GenericMenu(); - - // Add entries to select control scheme, if we have some. - if (m_ControlSchemes.LengthSafe() > 0) - { - menu.AddItem(s_AllControlSchemes, m_SelectedControlSchemeIndex == -1, OnControlSchemeSelected, null); - var selectedControlSchemeName = m_SelectedControlSchemeIndex == -1 - ? null : m_ControlSchemes[m_SelectedControlSchemeIndex].name; - foreach (var controlScheme in m_ControlSchemes.OrderBy(x => x.name)) - menu.AddItem(new GUIContent(controlScheme.name), - controlScheme.name == selectedControlSchemeName, OnControlSchemeSelected, - controlScheme.name); - - menu.AddSeparator(string.Empty); - } - - // Add entries to add/edit/duplicate/delete control schemes. - menu.AddItem(s_AddControlSchemeLabel, false, OnAddControlScheme, buttonRect); - if (m_SelectedControlSchemeIndex >= 0) - { - menu.AddItem(s_EditControlSchemeLabel, false, OnEditSelectedControlScheme, buttonRect); - menu.AddItem(s_DuplicateControlSchemeLabel, false, OnDuplicateControlScheme, buttonRect); - menu.AddItem(s_DeleteControlSchemeLabel, false, OnDeleteControlScheme); - } - else - { - menu.AddDisabledItem(s_EditControlSchemeLabel, false); - menu.AddDisabledItem(s_DuplicateControlSchemeLabel, false); - menu.AddDisabledItem(s_DeleteControlSchemeLabel, false); - } - - menu.ShowAsContext(); - } - } - - private void DrawDeviceFilterSelection() - { - // Lazy-initialize list of GUIContents that represent each individual device requirement. - if (m_SelectedSchemeDeviceRequirementNames == null && m_ControlSchemes.LengthSafe() > 0 && m_SelectedControlSchemeIndex >= 0) - { - m_SelectedSchemeDeviceRequirementNames = m_ControlSchemes[m_SelectedControlSchemeIndex] - .deviceRequirements.Select(x => new GUIContent(DeviceRequirementToDisplayString(x))) - .ToArray(); - } - - EditorGUI.BeginDisabledGroup(m_SelectedControlSchemeIndex < 0); - if (m_SelectedSchemeDeviceRequirementNames.LengthSafe() == 0) - { - GUILayout.Button(s_AllDevicesLabel, EditorStyles.toolbarPopup, GUILayout.MinWidth(k_MinimumButtonWidth)); - } - else if (GUILayout.Button(m_SelectedDeviceRequirementIndex < 0 ? s_AllDevicesLabel : m_SelectedSchemeDeviceRequirementNames[m_SelectedDeviceRequirementIndex], - EditorStyles.toolbarPopup, GUILayout.MinWidth(k_MinimumButtonWidth))) - { - var menu = new GenericMenu(); - menu.AddItem(s_AllDevicesLabel, m_SelectedControlSchemeIndex == -1, OnSelectedDeviceChanged, -1); - for (var i = 0; i < m_SelectedSchemeDeviceRequirementNames.Length; i++) - menu.AddItem(m_SelectedSchemeDeviceRequirementNames[i], m_SelectedDeviceRequirementIndex == i, OnSelectedDeviceChanged, i); - menu.ShowAsContext(); - } - EditorGUI.EndDisabledGroup(); - } - - private void DrawSaveButton() - { - EditorGUI.BeginDisabledGroup(!m_IsDirty); - EditorGUILayout.Space(); - if (GUILayout.Button(s_SaveAssetLabel, EditorStyles.toolbarButton)) - onSave(); - EditorGUI.EndDisabledGroup(); - } - - private void DrawAutoSaveToggle() - { - ////FIXME: Using a normal Toggle style with a miniFont, I can't get the "Auto-Save" label to align properly on the vertical. - //// The workaround here splits it into a toggle with an empty label plus an extra label. - //// Not using EditorStyles.toolbarButton here as it makes it hard to tell that it's a toggle. - if (s_MiniToggleStyle == null) - { - s_MiniToggleStyle = new GUIStyle("Toggle") - { - font = EditorStyles.miniFont, - margin = new RectOffset(0, 0, 1, 0), - padding = new RectOffset(0, 16, 0, 0) - }; - s_MiniLabelStyle = new GUIStyle("Label") - { - font = EditorStyles.miniFont, - margin = new RectOffset(0, 0, 3, 0) - }; - } - - var autoSaveNew = GUILayout.Toggle(InputEditorUserSettings.autoSaveInputActionAssets, "", - s_MiniToggleStyle); - GUILayout.Label(s_AutoSaveLabel, s_MiniLabelStyle); - if (autoSaveNew != InputEditorUserSettings.autoSaveInputActionAssets && autoSaveNew && m_IsDirty) - { - // If it changed from disabled to enabled, perform an initial save. - onSave(); - } - - InputEditorUserSettings.autoSaveInputActionAssets = autoSaveNew; - - GUILayout.Space(5); - } - - private void DrawSearchField() - { - if (m_SearchField == null) - m_SearchField = new SearchField(); - - EditorGUI.BeginChangeCheck(); - m_SearchText = m_SearchField.OnToolbarGUI(m_SearchText, GUILayout.MaxWidth(250)); - if (EditorGUI.EndChangeCheck()) - onSearchChanged?.Invoke(); - } - - private void OnControlSchemeSelected(object nameObj) - { - var index = -1; - var name = (string)nameObj; - if (name != null) - { - index = ArrayHelpers.IndexOf(m_ControlSchemes, - x => x.name.Equals(name, StringComparison.InvariantCultureIgnoreCase)); - Debug.Assert(index != -1, $"Cannot find control scheme {name}"); - } - - m_SelectedControlSchemeIndex = index; - m_SelectedDeviceRequirementIndex = -1; - m_SelectedSchemeDeviceRequirementNames = null; - - onSelectedSchemeChanged?.Invoke(); - } - - private void OnSelectedDeviceChanged(object indexObj) - { - Debug.Assert(m_SelectedControlSchemeIndex >= 0, "Control scheme must be selected"); - - m_SelectedDeviceRequirementIndex = (int)indexObj; - onSelectedDeviceChanged?.Invoke(); - } - - private void OnAddControlScheme(object position) - { - var uniqueName = MakeUniqueControlSchemeName("New control scheme"); - ControlSchemePropertiesPopup.Show((Rect)position, - new InputControlScheme(uniqueName), - (s, _) => AddAndSelectControlScheme(s)); - } - - private void OnDeleteControlScheme() - { - Debug.Assert(m_SelectedControlSchemeIndex >= 0, "Control scheme must be selected"); - - var name = m_ControlSchemes[m_SelectedControlSchemeIndex].name; - var bindingGroup = m_ControlSchemes[m_SelectedControlSchemeIndex].bindingGroup; - - // Ask for confirmation. - if (!EditorUtility.DisplayDialog("Delete scheme?", $"Do you want to delete control scheme '{name}'?", - "Delete", "Cancel")) - return; - - ArrayHelpers.EraseAt(ref m_ControlSchemes, m_SelectedControlSchemeIndex); - m_SelectedControlSchemeIndex = -1; - m_SelectedSchemeDeviceRequirementNames = null; - - if (m_SelectedDeviceRequirementIndex >= 0) - { - m_SelectedDeviceRequirementIndex = -1; - onSelectedDeviceChanged?.Invoke(); - } - - onControlSchemesChanged?.Invoke(); - onSelectedSchemeChanged?.Invoke(); - onControlSchemeDeleted?.Invoke(name, bindingGroup); - } - - ////REVIEW: this does nothing to bindings; should this ask to duplicate bindings as well? - private void OnDuplicateControlScheme(object position) - { - Debug.Assert(m_SelectedControlSchemeIndex >= 0, "Control scheme must be selected"); - - var scheme = m_ControlSchemes[m_SelectedControlSchemeIndex]; - scheme = new InputControlScheme(MakeUniqueControlSchemeName(scheme.name), - devices: scheme.deviceRequirements); - - ControlSchemePropertiesPopup.Show((Rect)position, scheme, - (s, _) => AddAndSelectControlScheme(s)); - } - - private void OnEditSelectedControlScheme(object position) - { - Debug.Assert(m_SelectedControlSchemeIndex >= 0, "Control scheme must be selected"); - - ControlSchemePropertiesPopup.Show((Rect)position, - m_ControlSchemes[m_SelectedControlSchemeIndex], - UpdateControlScheme, - m_SelectedControlSchemeIndex); - } - - private void AddAndSelectControlScheme(InputControlScheme scheme) - { - // Ensure scheme has a name. - if (string.IsNullOrEmpty(scheme.name)) - scheme.m_Name = "New control scheme"; - - // Make sure name is unique. - scheme.m_Name = MakeUniqueControlSchemeName(scheme.name); - - var index = ArrayHelpers.Append(ref m_ControlSchemes, scheme); - onControlSchemesChanged?.Invoke(); - - SelectControlScheme(index); - } - - private void UpdateControlScheme(InputControlScheme scheme, int index) - { - Debug.Assert(index >= 0 && index < m_ControlSchemes.LengthSafe(), "Control scheme index out of range"); - - var renamed = false; - string oldBindingGroup = null; - string newBindingGroup = null; - - // If given scheme has no name, preserve the existing one on the control scheme. - if (string.IsNullOrEmpty(scheme.name)) - scheme.m_Name = m_ControlSchemes[index].name; - - // If name is changing, make sure it's unique. - else if (scheme.name != m_ControlSchemes[index].name) - { - renamed = true; - oldBindingGroup = m_ControlSchemes[index].bindingGroup; - m_ControlSchemes[index].m_Name = ""; // Don't want this to interfere with finding a unique name. - var newName = MakeUniqueControlSchemeName(scheme.name); - m_ControlSchemes[index].SetNameAndBindingGroup(newName); - newBindingGroup = m_ControlSchemes[index].bindingGroup; - } - - m_ControlSchemes[index] = scheme; - onControlSchemesChanged?.Invoke(); - - if (renamed) - onControlSchemeRenamed?.Invoke(oldBindingGroup, newBindingGroup); - } - - private void SelectControlScheme(int index) - { - Debug.Assert(index >= 0 && index < m_ControlSchemes.LengthSafe(), "Control scheme index out of range"); - - m_SelectedControlSchemeIndex = index; - m_SelectedSchemeDeviceRequirementNames = null; - onSelectedSchemeChanged?.Invoke(); - - // Reset device selection. - if (m_SelectedDeviceRequirementIndex != -1) - { - m_SelectedDeviceRequirementIndex = -1; - onSelectedDeviceChanged?.Invoke(); - } - } - - private string MakeUniqueControlSchemeName(string name) - { - const string presetName = "All Control Schemes"; - if (m_ControlSchemes == null) - return StringHelpers.MakeUniqueName(name, new[] {presetName}, x => x); - return StringHelpers.MakeUniqueName(name, m_ControlSchemes.Select(x => x.name).Append(presetName), x => x); - } - - private static string DeviceRequirementToDisplayString(InputControlScheme.DeviceRequirement requirement) - { - ////TODO: need something more flexible to produce correct results for more than the simple string we produce here - var deviceLayout = InputControlPath.TryGetDeviceLayout(requirement.controlPath); - var deviceLayoutText = !string.IsNullOrEmpty(deviceLayout) - ? EditorInputControlLayoutCache.GetDisplayName(deviceLayout) - : string.Empty; - var usages = InputControlPath.TryGetDeviceUsages(requirement.controlPath); - - if (usages != null && usages.Length > 0) - return $"{deviceLayoutText} {string.Join("}{", usages)}"; - - return deviceLayoutText; - } - - // Notifications. - public Action onSearchChanged; - public Action onSelectedSchemeChanged; - public Action onSelectedDeviceChanged; - public Action onControlSchemesChanged; - public Action onControlSchemeRenamed; - public Action onControlSchemeDeleted; - public Action onSave; - - [SerializeField] private bool m_IsDirty; - [SerializeField] private int m_SelectedControlSchemeIndex = -1; - [SerializeField] private int m_SelectedDeviceRequirementIndex = -1; - [SerializeField] private InputControlScheme[] m_ControlSchemes; - [SerializeField] private string m_SearchText; - - private GUIContent[] m_SelectedSchemeDeviceRequirementNames; - private SearchField m_SearchField; - - private static readonly GUIContent s_AllControlSchemes = EditorGUIUtility.TrTextContent("All Control Schemes"); - private static readonly GUIContent s_AddControlSchemeLabel = new GUIContent("Add Control Scheme..."); - private static readonly GUIContent s_EditControlSchemeLabel = EditorGUIUtility.TrTextContent("Edit Control Scheme..."); - private static readonly GUIContent s_DuplicateControlSchemeLabel = EditorGUIUtility.TrTextContent("Duplicate Control Scheme..."); - private static readonly GUIContent s_DeleteControlSchemeLabel = EditorGUIUtility.TrTextContent("Delete Control Scheme..."); - private static readonly GUIContent s_SaveAssetLabel = EditorGUIUtility.TrTextContent("Save Asset"); - private static readonly GUIContent s_AutoSaveLabel = EditorGUIUtility.TrTextContent("Auto-Save"); - private static readonly GUIContent s_AllDevicesLabel = EditorGUIUtility.TrTextContent("All Devices"); - - private static GUIStyle s_MiniToggleStyle; - private static GUIStyle s_MiniLabelStyle; - - private const float k_MinimumButtonWidth = 110f; - - public ReadOnlyArray controlSchemes - { - get => m_ControlSchemes; - set - { - m_ControlSchemes = value.ToArray(); - m_SelectedSchemeDeviceRequirementNames = null; - } - } - - /// - /// The control scheme currently selected in the toolbar or null if none is selected. - /// - public InputControlScheme? selectedControlScheme => m_SelectedControlSchemeIndex >= 0 - ? new InputControlScheme ? (m_ControlSchemes[m_SelectedControlSchemeIndex]) - : null; - - /// - /// The device requirement of the currently selected control scheme which is currently selected - /// in the toolbar or null if none is selected. - /// - public InputControlScheme.DeviceRequirement? selectedDeviceRequirement => m_SelectedDeviceRequirementIndex >= 0 - ? new InputControlScheme.DeviceRequirement ? (m_ControlSchemes[m_SelectedControlSchemeIndex] - .deviceRequirements[m_SelectedDeviceRequirementIndex]) - : null; - - /// - /// The search text currently entered in the toolbar or null. - /// - public string searchText => m_SearchText; - - internal void ResetSearchFilters() - { - m_SearchText = null; - m_SelectedControlSchemeIndex = -1; - m_SelectedDeviceRequirementIndex = -1; - } - - public bool isDirty - { - get => m_IsDirty; - set => m_IsDirty = value; - } - - /// - /// Popup window content for editing control schemes. - /// - private class ControlSchemePropertiesPopup : PopupWindowContent - { - public static void Show(Rect position, InputControlScheme controlScheme, Action onApply, - int controlSchemeIndex = -1) - { - var popup = new ControlSchemePropertiesPopup - { - m_ControlSchemeIndex = controlSchemeIndex, - m_ControlScheme = controlScheme, - m_OnApply = onApply, - m_SetFocus = true, - }; - - // We're calling here from a callback, so we need to manually handle ExitGUIException. - try - { - PopupWindow.Show(position, popup); - } - catch (ExitGUIException) {} - } - - public override Vector2 GetWindowSize() - { - return m_ButtonsAndLabelsHeights > 0 ? new Vector2(300, m_ButtonsAndLabelsHeights) : s_DefaultSize; - } - - public override void OnOpen() - { - m_DeviceList = m_ControlScheme.deviceRequirements.Select(a => new DeviceEntry(a)).ToList(); - m_DeviceView = new ReorderableList(m_DeviceList, typeof(InputControlScheme.DeviceRequirement)); - m_DeviceView.headerHeight = 2; - m_DeviceView.onAddCallback += list => - { - var dropdown = new InputControlPickerDropdown( - new InputControlPickerState(), - path => - { - var requirement = new InputControlScheme.DeviceRequirement - { - controlPath = path, - isOptional = false - }; - - AddDeviceRequirement(requirement); - }, - mode: InputControlPicker.Mode.PickDevice); - dropdown.Show(new Rect(Event.current.mousePosition, Vector2.zero)); - }; - m_DeviceView.onRemoveCallback += list => - { - list.list.RemoveAt(list.index); - list.index = -1; - }; - } - - public override void OnGUI(Rect rect) - { - if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Escape) - { - editorWindow.Close(); - Event.current.Use(); - } - - if (Event.current.type == EventType.Repaint) - m_ButtonsAndLabelsHeights = 0; - - GUILayout.BeginArea(rect); - DrawTopBar(); - EditorGUILayout.BeginVertical(EditorStyles.label); - DrawSpace(); - DrawNameEditTextField(); - DrawSpace(); - DrawDeviceList(); - DrawConfirmationButton(); - EditorGUILayout.EndVertical(); - GUILayout.EndArea(); - } - - private void DrawConfirmationButton() - { - EditorGUILayout.BeginHorizontal(); - if (GUILayout.Button("Cancel", GUILayout.ExpandWidth(true))) - { - editorWindow.Close(); - } - if (GUILayout.Button("Save", GUILayout.ExpandWidth(true))) - { - // Don't allow control scheme name to be empty. - if (string.IsNullOrEmpty(m_ControlScheme.name)) - { - ////FIXME: On 2019.1 this doesn't display properly in the window; check 2019.3 - editorWindow.ShowNotification(new GUIContent("Control scheme must have a name")); - } - else - { - m_ControlScheme = new InputControlScheme(m_ControlScheme.name, - devices: m_DeviceList.Select(a => a.deviceRequirement)); - - editorWindow.Close(); - m_OnApply(m_ControlScheme, m_ControlSchemeIndex); - } - } - if (Event.current.type == EventType.Repaint) - m_ButtonsAndLabelsHeights += GUILayoutUtility.GetLastRect().height; - EditorGUILayout.EndHorizontal(); - } - - private void DrawDeviceList() - { - EditorGUILayout.BeginHorizontal(EditorStyles.label); - var requirementsLabelSize = EditorStyles.label.CalcSize(s_RequirementsLabel); - var deviceListRect = GUILayoutUtility.GetRect(GetWindowSize().x - requirementsLabelSize.x - 20, m_DeviceView.GetHeight()); - m_DeviceView.DoList(deviceListRect); - var requirementsHeight = DrawRequirementsCheckboxes(); - var listHeight = m_DeviceView.GetHeight() + EditorGUIUtility.singleLineHeight * 3; - if (Event.current.type == EventType.Repaint) - { - if (listHeight < requirementsHeight) - { - m_ButtonsAndLabelsHeights += requirementsHeight; - } - else - { - m_ButtonsAndLabelsHeights += listHeight; - } - } - - EditorGUILayout.EndHorizontal(); - } - - private void DrawSpace() - { - GUILayout.Space(6f); - if (Event.current.type == EventType.Repaint) - m_ButtonsAndLabelsHeights += 6f; - } - - private void DrawTopBar() - { - EditorGUILayout.LabelField(s_AddControlSchemeLabel, Styles.headerLabel); - - if (Event.current.type == EventType.Repaint) - m_ButtonsAndLabelsHeights += GUILayoutUtility.GetLastRect().height; - } - - private void DrawNameEditTextField() - { - EditorGUILayout.BeginHorizontal(); - var labelSize = EditorStyles.label.CalcSize(s_ControlSchemeNameLabel); - EditorGUILayout.LabelField(s_ControlSchemeNameLabel, GUILayout.Width(labelSize.x)); - - GUI.SetNextControlName("ControlSchemeName"); - ////FIXME: This should be a DelayedTextField but for some reason (maybe because it's in a popup?), this - //// will lead to the text field not working correctly. Hitting enter on the keyboard will apply the - //// change as expected but losing focus will *NOT*. In most cases, this makes the text field seem not - //// to work at all so instead we use a normal text field here and then apply the name change as part - //// of apply the control scheme changes as a whole. The only real downside is that if the name gets - //// adjusted automatically because of a naming conflict, this will only become evident *after* hitting - //// the "Save" button. - m_ControlScheme.m_Name = EditorGUILayout.TextField(m_ControlScheme.m_Name); - - if (m_SetFocus) - { - EditorGUI.FocusTextInControl("ControlSchemeName"); - m_SetFocus = false; - } - - EditorGUILayout.EndHorizontal(); - } - - private float DrawRequirementsCheckboxes() - { - EditorGUILayout.BeginVertical(); - EditorGUILayout.LabelField(s_RequirementsLabel, GUILayout.Width(200)); - var requirementHeights = GUILayoutUtility.GetLastRect().y; - EditorGUI.BeginDisabledGroup(m_DeviceView.index == -1); - var requirementsOption = -1; - if (m_DeviceView.index >= 0) - { - var deviceEntryForList = (DeviceEntry)m_DeviceView.list[m_DeviceView.index]; - requirementsOption = deviceEntryForList.deviceRequirement.isOptional ? 0 : 1; - } - EditorGUI.BeginChangeCheck(); - requirementsOption = GUILayout.SelectionGrid(requirementsOption, s_RequiredOptionalChoices, 1, EditorStyles.radioButton); - requirementHeights += GUILayoutUtility.GetLastRect().y; - if (EditorGUI.EndChangeCheck()) - m_DeviceList[m_DeviceView.index].deviceRequirement.isOptional = requirementsOption == 0; - EditorGUI.EndDisabledGroup(); - EditorGUILayout.EndVertical(); - return requirementHeights; - } - - private void AddDeviceRequirement(InputControlScheme.DeviceRequirement requirement) - { - ArrayHelpers.Append(ref m_ControlScheme.m_DeviceRequirements, requirement); - m_DeviceList.Add(new DeviceEntry(requirement)); - m_DeviceView.index = m_DeviceView.list.Count - 1; - - editorWindow.Repaint(); - } - - /// - /// The control scheme edited by the popup. - /// - public InputControlScheme controlScheme => m_ControlScheme; - - private int m_ControlSchemeIndex; - private InputControlScheme m_ControlScheme; - private Action m_OnApply; - - private ReorderableList m_DeviceView; - private List m_DeviceList = new List(); - private int m_RequirementsOptionsChoice; - - private bool m_SetFocus; - private float m_ButtonsAndLabelsHeights; - - private static Vector2 s_DefaultSize => new Vector2(300, 200); - private static readonly GUIContent s_RequirementsLabel = EditorGUIUtility.TrTextContent("Requirements:"); - private static readonly GUIContent s_AddControlSchemeLabel = EditorGUIUtility.TrTextContent("Add control scheme"); - private static readonly GUIContent s_ControlSchemeNameLabel = EditorGUIUtility.TrTextContent("Scheme Name"); - private static readonly string[] s_RequiredOptionalChoices = { "Optional", "Required" }; - - private static class Styles - { - public static readonly GUIStyle headerLabel = new GUIStyle(EditorStyles.toolbar) - .WithAlignment(TextAnchor.MiddleCenter) - .WithFontStyle(FontStyle.Bold) - .WithPadding(new RectOffset(10, 6, 0, 0)); - } - - private class DeviceEntry - { - public string displayText; - public InputControlScheme.DeviceRequirement deviceRequirement; - - public DeviceEntry(InputControlScheme.DeviceRequirement requirement) - { - displayText = DeviceRequirementToDisplayString(requirement); - deviceRequirement = requirement; - } - - public override string ToString() - { - return displayText; - } - } - } - } -} -#endif // UNITY_EDITOR diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorToolbar.cs.meta b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorToolbar.cs.meta deleted file mode 100644 index 5eb8683fad..0000000000 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorToolbar.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: 9e1e1ebbe5ff04f03bf06ab5398454cf -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs deleted file mode 100644 index dd9af16116..0000000000 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs +++ /dev/null @@ -1,843 +0,0 @@ -#if UNITY_EDITOR -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using UnityEditor; -using UnityEditor.Callbacks; -using UnityEditor.IMGUI.Controls; -using UnityEditor.PackageManager.UI; -using UnityEditor.ShortcutManagement; - -#if UNITY_6000_2_OR_NEWER -using TreeView = UnityEditor.IMGUI.Controls.TreeView; -using TreeViewState = UnityEditor.IMGUI.Controls.TreeViewState; -#endif - -////TODO: Add "Revert" button - -////TODO: add helpers to very quickly set up certain common configs (e.g. "FPS Controls" in add-action context menu; -//// "WASD Control" in add-binding context menu) - -////REVIEW: should we listen for Unity project saves and save dirty .inputactions assets along with it? - -////FIXME: when saving, processor/interaction selection is cleared - -////TODO: persist view state of asset in Library/ folder - -namespace UnityEngine.InputSystem.Editor -{ - /// - /// An editor window to edit .inputactions assets. - /// - /// - /// The .inputactions editor code does not really separate between model and view. Selection state is contained - /// in the tree views and persistent across domain reloads via . - /// - internal class InputActionEditorWindow : EditorWindow, IDisposable, IInputActionAssetEditor - { - // Register editor type via static constructor to enable asset monitoring - static InputActionEditorWindow() - { - InputActionAssetEditor.RegisterType(); - } - - // Unity 6.3 changed signature of OpenAsset, and now it accepts entity id instead of instance id. - [OnOpenAsset] -#if UNITY_6000_3_OR_NEWER - public static bool OpenAsset(EntityId entityId, int line) - { - if (!InputActionImporter.IsInputActionAssetPath(AssetDatabase.GetAssetPath(entityId))) - return false; - - return OpenAsset(EditorUtility.EntityIdToObject(entityId)); - } - -#else - public static bool OpenAsset(int instanceId, int line) - { - if (!InputActionImporter.IsInputActionAssetPath(AssetDatabase.GetAssetPath(instanceId))) - return false; - - return OpenAsset(EditorUtility.InstanceIDToObject(instanceId)); - } - -#endif - - /// - /// Open window if someone clicks on an .inputactions asset or an action inside of it. - /// - private static bool OpenAsset(Object obj) - { - if (!InputSystem.settings.useIMGUIEditorForAssets) - return false; - - string mapToSelect = null; - string actionToSelect = null; - - // 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. - var asset = obj as InputActionAsset; - if (asset == null) - { - // Check if the user clicked on an action inside the asset. - var actionReference = obj as InputActionReference; - if (actionReference != null) - { - asset = actionReference.asset; - mapToSelect = actionReference.action.actionMap.name; - actionToSelect = actionReference.action.name; - } - else - return false; - } - - var window = OpenEditor(asset); - - // If user clicked on an action inside the asset, focus on that action (if we can find it). - if (actionToSelect != null && window.m_ActionMapsTree.TrySelectItem(mapToSelect)) - { - window.OnActionMapTreeSelectionChanged(); - window.m_ActionsTree.SelectItem(actionToSelect); - } - - return true; - } - - /// - /// Open the specified in an editor window. Used when someone hits the "Edit Asset" button in the - /// importer inspector. - /// - /// The InputActionAsset to open. - /// The editor window. - public static InputActionEditorWindow OpenEditor(InputActionAsset asset) - { - ////REVIEW: It'd be great if the window got docked by default but the public EditorWindow API doesn't allow that - //// to be done for windows that aren't singletons (GetWindow() will only create one window and it's the - //// only way to get programmatic docking with the current API). - // See if we have an existing editor window that has the asset open. - var window = FindEditorForAsset(asset); - if (window == null) - { - // No, so create a new window. - window = CreateInstance(); - window.SetAsset(asset); - } - window.Show(); - window.Focus(); - - return window; - } - - private static InputActionEditorWindow FindEditorForAsset(InputActionAsset asset) - { - var guid = EditorHelpers.GetAssetGUID(asset); - return guid == null ? null : FindEditorForAssetWithGUID(guid); - } - - public static InputActionEditorWindow FindEditorForAssetWithGUID(string guid) - { - var windows = Resources.FindObjectsOfTypeAll(); - return windows.FirstOrDefault(w => w.m_ActionAssetManager.guid == guid); - } - - public void SaveChangesToAsset() - { - m_ActionAssetManager.SaveChangesToAsset(); - } - - public void AddNewActionMap() - { - m_ActionMapsTree.AddNewActionMap(); - } - - public void AddNewAction() - { - // Make sure we have an action map. If we don't have an action map selected, - // refuse the operation. - var actionMapItem = m_ActionMapsTree.GetSelectedItems().OfType().FirstOrDefault(); - if (actionMapItem == null) - { - EditorApplication.Beep(); - return; - } - - m_ActionsTree.AddNewAction(actionMapItem.property); - } - - public void AddNewBinding() - { - // Make sure we have an action selected. - var actionItems = m_ActionsTree.GetSelectedItems().OfType(); - if (!actionItems.Any()) - { - EditorApplication.Beep(); - return; - } - - foreach (var item in actionItems) - m_ActionsTree.AddNewBinding(item.property, item.actionMapProperty); - } - - private bool ConfirmSaveChangesIfNeeded() - { - // Ask for confirmation if we have unsaved changes. - if (!m_ForceQuit && m_ActionAssetManager.dirty) - { - var result = Dialog.InputActionAsset.ShowSaveChanges(m_ActionAssetManager.path); - switch (result) - { - case Dialog.Result.Save: - m_ActionAssetManager.SaveChangesToAsset(); - m_ActionAssetManager.Cleanup(); - break; - case Dialog.Result.Cancel: - Instantiate(this).Show(); - // Cancel editor quit. - return false; - case Dialog.Result.Discard: - // Don't save, don't ask again. - m_ForceQuit = true; - break; - default: - throw new ArgumentOutOfRangeException(nameof(result)); - } - } - return true; - } - - private bool EditorWantsToQuit() - { - return ConfirmSaveChangesIfNeeded(); - } - - private void OnEnable() - { - minSize = new Vector2(600, 300); - - // Initialize toolbar. We keep the toolbar across domain reloads but we - // will lose the delegates. - if (m_Toolbar == null) - m_Toolbar = new InputActionEditorToolbar(); - m_Toolbar.onSearchChanged = OnToolbarSearchChanged; - m_Toolbar.onSelectedSchemeChanged = OnControlSchemeSelectionChanged; - m_Toolbar.onSelectedDeviceChanged = OnControlSchemeSelectionChanged; - m_Toolbar.onSave = SaveChangesToAsset; - m_Toolbar.onControlSchemesChanged = OnControlSchemesModified; - m_Toolbar.onControlSchemeRenamed = OnControlSchemeRenamed; - m_Toolbar.onControlSchemeDeleted = OnControlSchemeDeleted; - EditorApplication.wantsToQuit += EditorWantsToQuit; - - // Initialize after assembly reload. - if (m_ActionAssetManager != null) - { - if (!m_ActionAssetManager.Initialize()) - { - // The asset we want to edit no longer exists. - Close(); - return; - } - m_ActionAssetManager.onDirtyChanged = OnDirtyChanged; - - InitializeTrees(); - } - - InputSystem.onSettingsChange += OnInputSettingsChanged; - } - - private void OnDestroy() - { - ConfirmSaveChangesIfNeeded(); - EditorApplication.wantsToQuit -= EditorWantsToQuit; - InputSystem.onSettingsChange -= OnInputSettingsChanged; - } - - private void OnInputSettingsChanged() - { - Repaint(); - } - - // Set asset would usually only be called when the window is open - private void SetAsset(InputActionAsset asset) - { - if (asset == null) - return; - - m_ActionAssetManager = new InputActionAssetManager(asset) { onDirtyChanged = OnDirtyChanged }; - //m_ActionAssetManager.Initialize(); // TODO No longer needed when using constructor - - InitializeTrees(); - LoadControlSchemes(); - - // Select first action map in asset. - m_ActionMapsTree.SelectFirstToplevelItem(); - - UpdateWindowTitle(); - } - - private void UpdateWindowTitle() - { - var title = m_ActionAssetManager.name + " (Input Actions)"; - m_Title = new GUIContent(title); - m_DirtyTitle = new GUIContent("(*) " + m_Title.text); - titleContent = m_Title; - } - - private void LoadControlSchemes() - { - TransferControlSchemes(save: false); - } - - private void TransferControlSchemes(bool save) - { - // The easiest way to load and save control schemes is using SerializedProperties to just transfer the data - // between the InputControlScheme array in the toolbar and the one in the asset. Doing it this way rather than - // just overwriting the array in m_AssetManager.m_AssetObjectForEditing directly will make undo work. - using (var editorWindowObject = new SerializedObject(this)) - using (var controlSchemesArrayPropertyInWindow = editorWindowObject.FindProperty("m_Toolbar.m_ControlSchemes")) - using (var controlSchemesArrayPropertyInAsset = m_ActionAssetManager.serializedObject.FindProperty("m_ControlSchemes")) - { - Debug.Assert(controlSchemesArrayPropertyInWindow != null, $"Cannot find m_ControlSchemes in window"); - Debug.Assert(controlSchemesArrayPropertyInAsset != null, $"Cannot find m_ControlSchemes in asset"); - - if (save) - { - var json = controlSchemesArrayPropertyInWindow.CopyToJson(); - controlSchemesArrayPropertyInAsset.RestoreFromJson(json); - editorWindowObject.ApplyModifiedProperties(); - } - else - { - // Load. - var json = controlSchemesArrayPropertyInAsset.CopyToJson(); - controlSchemesArrayPropertyInWindow.RestoreFromJson(json); - editorWindowObject.ApplyModifiedPropertiesWithoutUndo(); - } - } - } - - private void OnControlSchemeSelectionChanged() - { - OnToolbarSearchChanged(); - LoadPropertiesForSelection(); - } - - private void OnControlSchemesModified() - { - TransferControlSchemes(save: true); - - // Control scheme changes may affect the search filter. - OnToolbarSearchChanged(); - - ApplyAndReloadTrees(); - } - - private void OnControlSchemeRenamed(string oldBindingGroup, string newBindingGroup) - { - InputActionSerializationHelpers.ReplaceBindingGroup(m_ActionAssetManager.serializedObject, - oldBindingGroup, newBindingGroup); - ApplyAndReloadTrees(); - } - - private void OnControlSchemeDeleted(string name, string bindingGroup) - { - Debug.Assert(!string.IsNullOrEmpty(name), "Control scheme name should not be empty"); - Debug.Assert(!string.IsNullOrEmpty(bindingGroup), "Binding group should not be empty"); - - var asset = m_ActionAssetManager.editedAsset; - - var bindingMask = InputBinding.MaskByGroup(bindingGroup); - var schemeHasBindings = asset.actionMaps.Any(m => m.bindings.Any(b => bindingMask.Matches(ref b))); - if (!schemeHasBindings) - return; - - ////FIXME: this does not delete composites that have bindings in only one control scheme - ////REVIEW: offer to do nothing and leave all bindings as is? - var deleteBindings = - EditorUtility.DisplayDialog("Delete Bindings?", - $"Delete bindings for '{name}' as well? If you select 'No', the bindings will only " - + $"be unassigned from the '{name}' control scheme but otherwise left as is. Note that bindings " - + $"that are assigned to '{name}' but also to other control schemes will be left in place either way.", - "Yes", "No"); - - InputActionSerializationHelpers.ReplaceBindingGroup(m_ActionAssetManager.serializedObject, bindingGroup, "", - deleteOrphanedBindings: deleteBindings); - - ApplyAndReloadTrees(); - } - - private void InitializeTrees() - { - // We persist tree view states (most importantly, they contain our selection states), - // so only create those if we don't have any yet. - if (m_ActionMapsTreeState == null) - m_ActionMapsTreeState = new TreeViewState(); - if (m_ActionsTreeState == null) - m_ActionsTreeState = new TreeViewState(); - - // Create tree in middle pane showing actions and bindings. We initially - // leave this tree empty and populate it by selecting an action map in the - // left pane tree. - m_ActionsTree = new InputActionTreeView(m_ActionAssetManager.serializedObject, m_ActionsTreeState) - { - onSelectionChanged = OnActionTreeSelectionChanged, - onSerializedObjectModified = ApplyAndReloadTrees, - onBindingAdded = p => InputActionSerializationHelpers.RemoveUnusedBindingGroups(p, m_Toolbar.controlSchemes), - drawMinusButton = false, - title = ("Actions", "A list of InputActions in the InputActionMap selected in the left pane. Also, for each InputAction, the list " - + "of bindings that determine the controls that can trigger the action.\n\nThe name of each action must be unique within its InputActionMap."), - }; - - // Create tree in left pane showing action maps. - m_ActionMapsTree = new InputActionTreeView(m_ActionAssetManager.serializedObject, m_ActionMapsTreeState) - { - onBuildTree = () => - InputActionTreeView.BuildWithJustActionMapsFromAsset(m_ActionAssetManager.serializedObject), - onSelectionChanged = OnActionMapTreeSelectionChanged, - onSerializedObjectModified = ApplyAndReloadTrees, - onHandleAddNewAction = m_ActionsTree.AddNewAction, - drawMinusButton = false, - title = ("Action Maps", "A list of InputActionMaps in the asset. Each map can be enabled and disabled separately at runtime and holds " - + "its own collection of InputActions which are listed in the middle pane (along with their InputBindings).") - }; - m_ActionMapsTree.Reload(); - m_ActionMapsTree.ExpandAll(); - - RebuildActionTree(); - LoadPropertiesForSelection(); - - // Sync current search status in toolbar. - OnToolbarSearchChanged(); - } - - /// - /// Synchronize the search filter applied to the trees. - /// - /// - /// Note that only filter the action tree. The action map tree remains unfiltered. - /// - private void OnToolbarSearchChanged() - { - // Rather than adding FilterCriterion instances directly, we go through the - // string-based format here. This allows typing queries directly into the search bar. - - var searchStringBuffer = new StringBuilder(); - - // Plain-text search. - if (!string.IsNullOrEmpty(m_Toolbar.searchText)) - searchStringBuffer.Append(m_Toolbar.searchText); - - // Filter by binding group of selected control scheme. - if (m_Toolbar.selectedControlScheme != null) - { - searchStringBuffer.Append(" \""); - searchStringBuffer.Append(InputActionTreeView.FilterCriterion.k_BindingGroupTag); - searchStringBuffer.Append(m_Toolbar.selectedControlScheme.Value.bindingGroup); - searchStringBuffer.Append('\"'); - } - - // Filter by device layout. - if (m_Toolbar.selectedDeviceRequirement != null) - { - searchStringBuffer.Append(" \""); - searchStringBuffer.Append(InputActionTreeView.FilterCriterion.k_DeviceLayoutTag); - searchStringBuffer.Append(InputControlPath.TryGetDeviceLayout(m_Toolbar.selectedDeviceRequirement.Value.controlPath)); - searchStringBuffer.Append('\"'); - } - - var searchString = searchStringBuffer.ToString(); - if (string.IsNullOrEmpty(searchString)) - m_ActionsTree.ClearItemSearchFilterAndReload(); - else - m_ActionsTree.SetItemSearchFilterAndReload(searchStringBuffer.ToString()); - - // Have trees create new bindings with the right binding group. - var currentBindingGroup = m_Toolbar.selectedControlScheme?.bindingGroup; - m_ActionsTree.bindingGroupForNewBindings = currentBindingGroup; - m_ActionMapsTree.bindingGroupForNewBindings = currentBindingGroup; - } - - /// - /// Synchronize the display state to the currently selected action map. - /// - private void OnActionMapTreeSelectionChanged() - { - // Re-configure action tree (middle pane) for currently select action map. - RebuildActionTree(); - - // If there's no actions in the selected action map or if there is no action map - // selected, make sure we wipe the property pane. - if (!m_ActionMapsTree.HasSelection() || !m_ActionsTree.rootItem.hasChildren) - { - LoadPropertiesForSelection(); - } - else - { - // Otherwise select first action in map. - m_ActionsTree.SelectFirstToplevelItem(); - } - } - - private void RebuildActionTree() - { - var selectedActionMapItem = - m_ActionMapsTree.GetSelectedItems().OfType().FirstOrDefault(); - if (selectedActionMapItem == null) - { - // Nothing selected. Wipe middle and right pane. - m_ActionsTree.onBuildTree = null; - } - else - { - m_ActionsTree.onBuildTree = () => - InputActionTreeView.BuildWithJustActionsAndBindingsFromMap(selectedActionMapItem.property); - } - - // Rebuild tree. - m_ActionsTree.Reload(); - } - - private void OnActionTreeSelectionChanged() - { - LoadPropertiesForSelection(); - } - - private void LoadPropertiesForSelection() - { - m_BindingPropertyView = null; - m_ActionPropertyView = null; - - ////TODO: preserve interaction/processor selection when reloading - - // Nothing else to do if we don't have a selection in the middle pane or if - // multiple items are selected (we don't currently have the ability to multi-edit). - if (!m_ActionsTree.HasSelection() || m_ActionsTree.GetSelection().Count != 1) - return; - - var item = m_ActionsTree.GetSelectedItems().FirstOrDefault(); - if (item is BindingTreeItem) - { - // Grab the action for the binding and see if we have an expected control layout - // set on it. Pass that on to the control picking machinery. - var isCompositePartBinding = item is PartOfCompositeBindingTreeItem; - var actionItem = (isCompositePartBinding ? item.parent.parent : item.parent) as ActionTreeItem; - Debug.Assert(actionItem != null); - - if (m_ControlPickerViewState == null) - m_ControlPickerViewState = new InputControlPickerState(); - - // The toolbar may constrain the set of devices we're currently interested in by either - // having one specific device selected from the current scheme or having at least a control - // scheme selected. - IEnumerable controlPathsToMatch; - if (m_Toolbar.selectedDeviceRequirement != null) - { - // Single device selected from set of devices in control scheme. - controlPathsToMatch = new[] { m_Toolbar.selectedDeviceRequirement.Value.controlPath }; - } - else if (m_Toolbar.selectedControlScheme != null) - { - // Constrain to devices from current control scheme. - controlPathsToMatch = - m_Toolbar.selectedControlScheme.Value.deviceRequirements.Select(x => x.controlPath); - } - else - { - // If there's no device filter coming from a control scheme, filter by supported - // devices as given by settings. - controlPathsToMatch = InputSystem.settings.supportedDevices.Select(x => $"<{x}>"); - } - - // Show properties for binding. - m_BindingPropertyView = - new InputBindingPropertiesView( - item.property, - change => - { - if (change == InputBindingPropertiesView.k_PathChanged || - change == InputBindingPropertiesView.k_CompositePartAssignmentChanged || - change == InputBindingPropertiesView.k_CompositeTypeChanged || - change == InputBindingPropertiesView.k_GroupsChanged) - { - ApplyAndReloadTrees(); - } - else - { - // Simple property change that doesn't affect the rest of the UI. - Apply(); - } - }, - m_ControlPickerViewState, - expectedControlLayout: item.expectedControlLayout, - controlSchemes: m_Toolbar.controlSchemes, - controlPathsToMatch: controlPathsToMatch); - } - else if (item is ActionTreeItem actionItem) - { - // Show properties for action. - m_ActionPropertyView = - new InputActionPropertiesView( - actionItem.property, - // Apply without reload is enough here as modifying the properties of an action will - // never change the structure of the data. - change => Apply()); - } - } - - private void ApplyAndReloadTrees() - { - Apply(); - - // This path here is meant to catch *any* edits made to the serialized data. I.e. also - // any arbitrary undo that may have changed some misc bit not visible in the trees. - - m_ActionMapsTree.Reload(); - RebuildActionTree(); - m_ActionAssetManager.UpdateAssetDirtyState(); - LoadControlSchemes(); - - LoadPropertiesForSelection(); - } - -#if UNITY_INPUT_SYSTEM_INPUT_ACTIONS_EDITOR_AUTO_SAVE_ON_FOCUS_LOST - private void OnLostFocus() - { - if (InputEditorUserSettings.autoSaveInputActionAssets) - m_ActionAssetManager.SaveChangesToAsset(); - } - -#endif - - private void Apply() - { - m_ActionAssetManager.ApplyChanges(); - - // Update dirty count, otherwise ReloadIfSerializedObjectHasBeenChanged will trigger a full ApplyAndReloadTrees - m_ActionMapsTree.UpdateSerializedObjectDirtyCount(); - m_ActionsTree.UpdateSerializedObjectDirtyCount(); - -#if UNITY_INPUT_SYSTEM_INPUT_ACTIONS_EDITOR_AUTO_SAVE_ON_FOCUS_LOST - // If auto-save should be triggered on focus lost, only mark asset as dirty - m_ActionAssetManager.MarkDirty(); - titleContent = m_DirtyTitle; -#else - // If auto-save is active, immediately flush out the changes to disk. Otherwise just - // put us into dirty state. - if (InputEditorUserSettings.autoSaveInputActionAssets) - { - m_ActionAssetManager.SaveChangesToAsset(); - } - else - { - m_ActionAssetManager.MarkDirty(); - titleContent = m_DirtyTitle; - } -#endif - } - - private void OnGUI() - { - // If the actions tree has lost the filters (because they would not match an item it tried to highlight), - // update the Toolbar UI to remove them. - if (!m_ActionsTree.hasFilter) - m_Toolbar.ResetSearchFilters(); - - // Allow switching between action map tree and action tree using arrow keys. - ToggleFocusUsingKeyboard(KeyCode.RightArrow, m_ActionMapsTree, m_ActionsTree); - ToggleFocusUsingKeyboard(KeyCode.LeftArrow, m_ActionsTree, m_ActionMapsTree); - - // Route copy-paste events to tree views if they have focus. - if (m_ActionsTree.HasFocus()) - m_ActionsTree.HandleCopyPasteCommandEvent(Event.current); - else if (m_ActionMapsTree.HasFocus()) - m_ActionMapsTree.HandleCopyPasteCommandEvent(Event.current); - - // Draw toolbar. - EditorGUILayout.BeginVertical(); - m_Toolbar.OnGUI(); - EditorGUILayout.Space(); - - // Draw columns. - EditorGUILayout.BeginHorizontal(); - var columnAreaWidth = position.width - InputActionTreeView.Styles.backgroundWithBorder.margin.left - - InputActionTreeView.Styles.backgroundWithBorder.margin.left - - InputActionTreeView.Styles.backgroundWithBorder.margin.right; - - var oldType = Event.current.type; - DrawActionMapsColumn(columnAreaWidth * 0.22f); - if (Event.current.type == EventType.Used && oldType != Event.current.type) - { - // When renaming an item, TreeViews will capture all mouse Events, and process any clicks outside the item - // being renamed to end the renaming process. However, since we have two TreeViews, if the action column is - // renaming an item, and then you double click on an item in the action map column, the action map column will - // get to use the mouse event before the action collumn gets to see it, which would cause the action map column - // to enter rename mode and use the event, before the action column gets a chance to see it and exit rename mode. - // Then we end up with two active renaming sessions, which does not work correctly. - // (See https://fogbugz.unity3d.com/f/cases/1140869/). - // Now, our fix to this problem is to force-end and accept any renaming session on the action column if we see - // that the action map column had processed the current event. This is not particularly elegant, but I cannot think - // of a better solution as we are limited by the public APIs exposed by TreeView. - m_ActionsTree.EndRename(forceAccept: true); - } - DrawActionsColumn(columnAreaWidth * 0.38f); - DrawPropertiesColumn(columnAreaWidth * 0.40f); - EditorGUILayout.EndHorizontal(); - - // Bottom margin. - GUILayout.Space(3); - EditorGUILayout.EndVertical(); - } - - private static void ToggleFocusUsingKeyboard(KeyCode key, InputActionTreeView fromTree, - InputActionTreeView toTree) - { - var uiEvent = Event.current; - if (uiEvent.type == EventType.KeyDown && uiEvent.keyCode == key && fromTree.HasFocus()) - { - if (!toTree.HasSelection()) - toTree.SelectFirstToplevelItem(); - toTree.SetFocus(); - uiEvent.Use(); - } - } - - private void DrawActionMapsColumn(float width) - { - DrawColumnWithTreeView(m_ActionMapsTree, width, true); - } - - private void DrawActionsColumn(float width) - { - DrawColumnWithTreeView(m_ActionsTree, width, false); - } - - private static void DrawColumnWithTreeView(TreeView treeView, float width, bool fixedWidth) - { - EditorGUILayout.BeginVertical(InputActionTreeView.Styles.backgroundWithBorder, - fixedWidth ? GUILayout.MaxWidth(width) : GUILayout.MinWidth(width), - GUILayout.ExpandWidth(true), GUILayout.ExpandHeight(true)); - GUILayout.FlexibleSpace(); - EditorGUILayout.EndVertical(); - - var columnRect = GUILayoutUtility.GetLastRect(); - - treeView.OnGUI(columnRect); - } - - private void DrawPropertiesColumn(float width) - { - EditorGUILayout.BeginVertical(InputActionTreeView.Styles.backgroundWithBorder, GUILayout.Width(width)); - - var rect = GUILayoutUtility.GetRect(0, - EditorGUIUtility.singleLineHeight + EditorGUIUtility.standardVerticalSpacing * 2, - GUILayout.ExpandWidth(true)); - rect.x -= 2; - rect.y -= 1; - rect.width += 4; - - EditorGUI.LabelField(rect, GUIContent.none, InputActionTreeView.Styles.backgroundWithBorder); - var headerRect = new Rect(rect.x + 1, rect.y + 1, rect.width - 2, rect.height - 2); - - if (m_BindingPropertyView != null) - { - if (m_BindingPropertiesTitle == null) - m_BindingPropertiesTitle = new GUIContent("Binding Properties", "The properties for the InputBinding selected in the " - + "'Actions' pane on the left."); - EditorGUI.LabelField(headerRect, m_BindingPropertiesTitle, InputActionTreeView.Styles.columnHeaderLabel); - m_PropertiesScroll = EditorGUILayout.BeginScrollView(m_PropertiesScroll); - m_BindingPropertyView.OnGUI(); - EditorGUILayout.EndScrollView(); - } - else if (m_ActionPropertyView != null) - { - if (m_ActionPropertiesTitle == null) - m_ActionPropertiesTitle = new GUIContent("Action Properties", "The properties for the InputAction selected in the " - + "'Actions' pane on the left."); - EditorGUI.LabelField(headerRect, m_ActionPropertiesTitle, InputActionTreeView.Styles.columnHeaderLabel); - m_PropertiesScroll = EditorGUILayout.BeginScrollView(m_PropertiesScroll); - m_ActionPropertyView.OnGUI(); - EditorGUILayout.EndScrollView(); - } - else - { - GUILayout.FlexibleSpace(); - } - - EditorGUILayout.EndVertical(); - } - - private void ReloadAssetFromFileIfNotDirty() - { - if (m_ActionAssetManager.dirty) - return; - - // If our asset has disappeared from disk, just close the window. - if (string.IsNullOrEmpty(AssetDatabase.GUIDToAssetPath(m_ActionAssetManager.guid))) - { - Close(); - return; - } - - // Don't touch the UI state if the serialized data is still the same. - if (!m_ActionAssetManager.ReInitializeIfAssetHasChanged()) - return; - - // Unfortunately, on this path we lose the selection state of the interactions and processors lists - // in the properties view. - - InitializeTrees(); - LoadPropertiesForSelection(); - Repaint(); - } - - private void OnDirtyChanged(bool dirty) - { - titleContent = dirty ? m_DirtyTitle : m_Title; - m_Toolbar.isDirty = dirty; - } - - public void Dispose() - { - m_BindingPropertyView?.Dispose(); - } - - [SerializeField] private TreeViewState m_ActionMapsTreeState; - [SerializeField] private TreeViewState m_ActionsTreeState; - [SerializeField] private InputControlPickerState m_ControlPickerViewState; - [SerializeField] private InputActionAssetManager m_ActionAssetManager; - [SerializeField] private InputActionEditorToolbar m_Toolbar; - [SerializeField] private GUIContent m_DirtyTitle; - [SerializeField] private GUIContent m_Title; - [NonSerialized] private GUIContent m_ActionPropertiesTitle; - [NonSerialized] private GUIContent m_BindingPropertiesTitle; - - private InputBindingPropertiesView m_BindingPropertyView; - private InputActionPropertiesView m_ActionPropertyView; - private InputActionTreeView m_ActionMapsTree; - private InputActionTreeView m_ActionsTree; - - private static bool s_RefreshPending; - - private Vector2 m_PropertiesScroll; - private bool m_ForceQuit; - - #region IInputActionAssetEditor - - public void OnAssetImported() => ReloadAssetFromFileIfNotDirty(); - - public void OnAssetMoved() => UpdateWindowTitle(); - - public void OnAssetDeleted() - { - m_ForceQuit = true; - Close(); - } - - public string assetGUID => m_ActionAssetManager.guid; - public bool isDirty => m_ActionAssetManager.dirty; - - #endregion - } -} -#endif // UNITY_EDITOR diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs.meta b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs.meta deleted file mode 100644 index c23e5ed101..0000000000 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs.meta +++ /dev/null @@ -1,11 +0,0 @@ -fileFormatVersion: 2 -guid: eb55afc2c109f42f2af37941a8c9300e -MonoImporter: - externalObjects: {} - serializedVersion: 2 - defaultReferences: [] - executionOrder: 0 - icon: {instanceID: 0} - userData: - assetBundleName: - assetBundleVariant: diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporterEditor.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporterEditor.cs index 09f16305be..f117089189 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporterEditor.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporterEditor.cs @@ -138,11 +138,7 @@ private static void OpenEditor(InputActionAsset asset) return; } - // Redirect to UI-Toolkit window editor if not configured to use IMGUI explicitly - if (!InputSystem.settings.useIMGUIEditorForAssets) - InputActionsEditorWindow.OpenEditor(asset); - else - InputActionEditorWindow.OpenEditor(asset); + InputActionsEditorWindow.OpenEditor(asset); } private readonly GUIContent m_GenerateWrapperCodeLabel = EditorGUIUtility.TrTextContent("Generate C# Class"); From cf2729d24696678cbc2866356f177581dbef6821 Mon Sep 17 00:00:00 2001 From: Anthony Yakovlev Date: Tue, 11 Nov 2025 19:17:50 +0300 Subject: [PATCH 5/6] apply formatting --- .../Samples/ProjectWideActions/ProjectWideActionsExample.cs | 3 +-- Assets/Tests/InputSystem.Editor/ControlSchemeEditorTests.cs | 2 +- .../InputSystem/Actions/Composites/AxisComposite.cs | 2 +- .../InputSystem/Actions/Composites/Vector2Composite.cs | 2 +- .../InputSystem/Actions/Composites/Vector3Composite.cs | 2 +- .../InputSystem/Actions/Interactions/HoldInteraction.cs | 4 ++-- .../InputSystem/Actions/Interactions/MultiTapInteraction.cs | 2 +- .../InputSystem/Actions/Interactions/PressInteraction.cs | 2 +- .../InputSystem/Actions/Interactions/SlowTapInteraction.cs | 2 +- .../InputSystem/Controls/Processors/AxisDeadzoneProcessor.cs | 2 +- .../InputSystem/Controls/Processors/StickDeadzoneProcessor.cs | 4 ++-- .../InputSystem/Editor/AssetEditor/ParameterListView.cs | 1 - .../InputSystem/Editor/AssetImporter/InputActionImporter.cs | 1 - 13 files changed, 13 insertions(+), 16 deletions(-) diff --git a/Assets/Samples/ProjectWideActions/ProjectWideActionsExample.cs b/Assets/Samples/ProjectWideActions/ProjectWideActionsExample.cs index 8c5377affd..8b066102dc 100644 --- a/Assets/Samples/ProjectWideActions/ProjectWideActionsExample.cs +++ b/Assets/Samples/ProjectWideActions/ProjectWideActionsExample.cs @@ -1,4 +1,3 @@ - namespace UnityEngine.InputSystem.Samples.ProjectWideActions { public class ProjectWideActionsExample : MonoBehaviour @@ -74,4 +73,4 @@ void Update() } } } // class ProjectWideActionsExample -} // namespace UnityEngine.InputSystem.Samples.ProjectWideActions \ No newline at end of file +} // namespace UnityEngine.InputSystem.Samples.ProjectWideActions diff --git a/Assets/Tests/InputSystem.Editor/ControlSchemeEditorTests.cs b/Assets/Tests/InputSystem.Editor/ControlSchemeEditorTests.cs index 377b79ff8e..403e03b59a 100644 --- a/Assets/Tests/InputSystem.Editor/ControlSchemeEditorTests.cs +++ b/Assets/Tests/InputSystem.Editor/ControlSchemeEditorTests.cs @@ -403,4 +403,4 @@ public void ChangeBindingsControlSchemesCommand_CanRemoveControlSchemes() Assert.That(groupsProperty.stringValue, Is.EqualTo(string.Empty)); } -} \ No newline at end of file +} diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/AxisComposite.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/AxisComposite.cs index acf12d4117..da72a70b8a 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/AxisComposite.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/AxisComposite.cs @@ -221,7 +221,7 @@ public override void OnGUI() { if (!InputSystem.settings.useIMGUIEditorForAssets) return; - + target.whichSideWins = (AxisComposite.WhichSideWins)EditorGUILayout.EnumPopup(m_WhichAxisWinsLabel, target.whichSideWins); } diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector2Composite.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector2Composite.cs index 5a60e472d4..730588db0c 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector2Composite.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector2Composite.cs @@ -201,7 +201,7 @@ public override void OnGUI() { if (!InputSystem.settings.useIMGUIEditorForAssets) return; - + target.mode = (Vector2Composite.Mode)EditorGUILayout.EnumPopup(m_ModeLabel, target.mode); } diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector3Composite.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector3Composite.cs index af3243ffc4..21383c700b 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector3Composite.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Composites/Vector3Composite.cs @@ -181,7 +181,7 @@ public override void OnGUI() { if (!InputSystem.settings.useIMGUIEditorForAssets) return; - + target.mode = (Vector3Composite.Mode)EditorGUILayout.EnumPopup(m_ModeLabel, target.mode); } diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/HoldInteraction.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/HoldInteraction.cs index ae3fdebd13..9345d5f9b0 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/HoldInteraction.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/HoldInteraction.cs @@ -124,9 +124,9 @@ protected override void OnEnable() public override void OnGUI() { - if (!InputSystem.settings.useIMGUIEditorForAssets) + if (!InputSystem.settings.useIMGUIEditorForAssets) return; - + m_PressPointSetting.OnGUI(); m_DurationSetting.OnGUI(); } diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/MultiTapInteraction.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/MultiTapInteraction.cs index 762a6850f4..41610ced29 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/MultiTapInteraction.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/MultiTapInteraction.cs @@ -198,7 +198,7 @@ public override void OnGUI() { if (!InputSystem.settings.useIMGUIEditorForAssets) return; - + target.tapCount = EditorGUILayout.IntField(m_TapCountLabel, target.tapCount); m_TapDelaySetting.OnGUI(); m_TapTimeSetting.OnGUI(); diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/PressInteraction.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/PressInteraction.cs index 8d04f3bc4b..f5361ae56b 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/PressInteraction.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/PressInteraction.cs @@ -215,7 +215,7 @@ 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(); diff --git a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/SlowTapInteraction.cs b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/SlowTapInteraction.cs index 677f142149..cb79393e00 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/SlowTapInteraction.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Actions/Interactions/SlowTapInteraction.cs @@ -90,7 +90,7 @@ public override void OnGUI() { if (!InputSystem.settings.useIMGUIEditorForAssets) return; - + m_DurationSetting.OnGUI(); m_PressPointSetting.OnGUI(); } diff --git a/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/AxisDeadzoneProcessor.cs b/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/AxisDeadzoneProcessor.cs index 029ee50d73..f86bb17c18 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/AxisDeadzoneProcessor.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/AxisDeadzoneProcessor.cs @@ -93,7 +93,7 @@ protected override void OnEnable() public override void OnGUI() { - if (!InputSystem.settings.useIMGUIEditorForAssets) + if (!InputSystem.settings.useIMGUIEditorForAssets) return; m_MinSetting.OnGUI(); diff --git a/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/StickDeadzoneProcessor.cs b/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/StickDeadzoneProcessor.cs index e08540d279..631f7b51d5 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/StickDeadzoneProcessor.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Controls/Processors/StickDeadzoneProcessor.cs @@ -82,9 +82,9 @@ protected override void OnEnable() public override void OnGUI() { - if (!InputSystem.settings.useIMGUIEditorForAssets) + if (!InputSystem.settings.useIMGUIEditorForAssets) return; - + m_MinSetting.OnGUI(); m_MaxSetting.OnGUI(); } diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/ParameterListView.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/ParameterListView.cs index 31c4b14216..25bd44764c 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/ParameterListView.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/ParameterListView.cs @@ -342,7 +342,6 @@ void OnEditEnd() } } - private void OnValuesChanged() { ReadParameterValuesFrom(m_ParameterEditor.target); diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporter.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporter.cs index 477f9ce31f..e695f2b7eb 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporter.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetImporter/InputActionImporter.cs @@ -324,7 +324,6 @@ internal static IEnumerable LoadInputActionReferencesFromA return inputActionReferencesList; } - // Add item to plop an .inputactions asset into the project. [MenuItem("Assets/Create/Input Actions")] public static void CreateInputAsset() From 549d2aa1e5e2cfeef7ca71fd832b8c9851b17567 Mon Sep 17 00:00:00 2001 From: Anthony Yakovlev Date: Tue, 11 Nov 2025 19:19:45 +0300 Subject: [PATCH 6/6] update the release note --- Packages/com.unity.inputsystem/CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index 78ba7e238a..2da422da07 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -10,7 +10,8 @@ however, it has to be formatted properly to pass verification tests. ## [Unreleased] - yyyy-mm-dd - +### Changed +- Project-Wide Input Actions can no longer be disabled (removed the UNITY_INPUT_SYSTEM_PROJECT_WIDE_ACTIONS define) ## [1.16.0] - 2025-11-10