From 8afb16368d48d1fe656156145153c4268c640ad1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Freire?= Date: Tue, 15 Aug 2023 13:08:59 +0200 Subject: [PATCH] Enable IMGUI Asset Editor for custom input action assets The UITK Editor view is only enabled for the Project Wide Actions Asset Editor, in the Project Settings. --- .../Editor/AssetEditor/InputActionEditorWindow.cs | 3 +-- .../Editor/UITKAssetEditor/InputActionsEditorWindow.cs | 9 ++++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs index 068c5c1138..09ac63ad88 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/AssetEditor/InputActionEditorWindow.cs @@ -38,10 +38,9 @@ internal class InputActionEditorWindow : EditorWindow, IDisposable public static bool OnOpenAsset(int instanceId, int line) { #if UNITY_INPUT_SYSTEM_UI_TK_ASSET_EDITOR - if (InputSystem.settings.IsFeatureEnabled(InputFeatureNames.kUseUIToolkitEditor)) + if (InputSystem.settings.IsFeatureEnabled(InputFeatureNames.kUseUIToolkitEditor) && InputActionsEditorWindow.isWindowEnabled) return false; #endif - var path = AssetDatabase.GetAssetPath(instanceId); if (!path.EndsWith(k_FileExtension, StringComparison.InvariantCultureIgnoreCase)) return false; diff --git a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs index e76064f195..ab117df96a 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Editor/UITKAssetEditor/InputActionsEditorWindow.cs @@ -24,12 +24,19 @@ static EnableUITKEditor() internal class InputActionsEditorWindow : EditorWindow { private static readonly string k_FileExtension = "." + InputActionAsset.Extension; + /// + /// Controls whether the UITK version of the InputActionAsset Editor is enabled or not for editing Input Action + /// assets. + /// + /// At the moment, the UITK Asset Editor doesn't have feature parity with the IMGUI version. + /// This is set to false to show the IMGUI version of the InputActionAsset Editor instead. + internal static bool isWindowEnabled = false; private int m_AssetId; [OnOpenAsset] public static bool OpenAsset(int instanceId, int line) { - if (!InputSystem.settings.IsFeatureEnabled(InputFeatureNames.kUseUIToolkitEditor)) + if (!InputSystem.settings.IsFeatureEnabled(InputFeatureNames.kUseUIToolkitEditor) || !isWindowEnabled) return false; var path = AssetDatabase.GetAssetPath(instanceId);