From 6c1586cf4d472801819e6080253661e9b991a0d2 Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Wed, 27 Aug 2025 17:46:44 +0200 Subject: [PATCH 01/15] Add fix for ISXB-1560 warnings issue. --- .../Plugins/InputForUI/InputActionAssetVerifier.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs index f42433be8b..7c1b68fdc1 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs @@ -1,4 +1,5 @@ #if UNITY_EDITOR && ENABLE_INPUT_SYSTEM && UNITY_2023_2_OR_NEWER +using System; using System.Collections.Generic; using UnityEditor; using UnityEngine.InputSystem.Editor; @@ -70,7 +71,11 @@ public Context(InputActionAsset asset, private string GetAssetReference() { var path = AssetDatabase.GetAssetPath(asset); - return path ?? asset.name; + if (path == String.Empty) + { + return asset.name; + } + return path; } private void ActionMapWarning(string actionMap, string problem) @@ -96,7 +101,7 @@ public void Verify(string actionNameOrId, InputActionType actionType, string exp if (index > 0) { var path = actionNameOrId.Substring(0, index); - if (asset.FindActionMap(path) == null) + if (asset.FindActionMap(path) == null && asset.actionMaps.Count > 0) { if (missingPaths == null) missingPaths = new HashSet(1); @@ -106,7 +111,7 @@ public void Verify(string actionNameOrId, InputActionType actionType, string exp } } - if (!noMapOrMapExists && policy == ReportPolicy.SuppressChildErrors) + if (noMapOrMapExists && policy == ReportPolicy.SuppressChildErrors) return; ActionWarning(actionNameOrId, kCouldNotBeFound); From 2efad11b6cc14d9cd98814de54682fe27bf923b8 Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 28 Aug 2025 11:12:03 +0200 Subject: [PATCH 02/15] Fix issue with all warning log's being shown when they shouldn't be. --- .../Plugins/InputForUI/InputActionAssetVerifier.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs index 7c1b68fdc1..bc9ebdc5ac 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs @@ -97,11 +97,16 @@ public void Verify(string actionNameOrId, InputActionType actionType, string exp // Check if the map (if any) exists var noMapOrMapExists = true; + if (asset.actionMaps.Count > 0) + { + return; + } + var index = actionNameOrId.IndexOf('/'); if (index > 0) { var path = actionNameOrId.Substring(0, index); - if (asset.FindActionMap(path) == null && asset.actionMaps.Count > 0) + if (asset.FindActionMap(path) == null) { if (missingPaths == null) missingPaths = new HashSet(1); @@ -111,7 +116,7 @@ public void Verify(string actionNameOrId, InputActionType actionType, string exp } } - if (noMapOrMapExists && policy == ReportPolicy.SuppressChildErrors) + if (!noMapOrMapExists && policy == ReportPolicy.SuppressChildErrors) return; ActionWarning(actionNameOrId, kCouldNotBeFound); From bcae7e7522e2ae015b549db2b538a7ef8078e74c Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 28 Aug 2025 12:14:47 +0200 Subject: [PATCH 03/15] Update the changelog. --- Packages/com.unity.inputsystem/CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index be6af59c51..12ce448d45 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -13,6 +13,7 @@ however, it has to be formatted properly to pass verification tests. ### Fixed - Fixed an issue where using Pen devices on Android tablets would result in double clicks for UI interactions. [ISXB-1456](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1456) - Fixed an issue preventing an embedded platform from being released. It adds back some `#defines` to `XRSupport` and `InputDeviceCharacteristics`. +- Fixed a warning not showing the asset name correctly when the input action map parameters for runtime GUI were not setup.[ISXB-1560] ## [1.14.1] - 2025-07-10 From 0778d3e063827da90d0babcc011dfacb9bd0a73f Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 28 Aug 2025 12:24:00 +0200 Subject: [PATCH 04/15] Fix incorrect check caused by moving code while refactoring. --- .../Plugins/InputForUI/InputActionAssetVerifier.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs index bc9ebdc5ac..45e77c9460 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs @@ -71,7 +71,7 @@ public Context(InputActionAsset asset, private string GetAssetReference() { var path = AssetDatabase.GetAssetPath(asset); - if (path == String.Empty) + if (path == string.Empty) { return asset.name; } @@ -97,7 +97,7 @@ public void Verify(string actionNameOrId, InputActionType actionType, string exp // Check if the map (if any) exists var noMapOrMapExists = true; - if (asset.actionMaps.Count > 0) + if (asset.actionMaps.Count == 0) { return; } From 284d7361194ec7959a8fbbf515ac582e823ec5be Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 28 Aug 2025 12:26:47 +0200 Subject: [PATCH 05/15] Remove redundant using. --- .../InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs index 45e77c9460..920ff68794 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs @@ -1,5 +1,4 @@ #if UNITY_EDITOR && ENABLE_INPUT_SYSTEM && UNITY_2023_2_OR_NEWER -using System; using System.Collections.Generic; using UnityEditor; using UnityEngine.InputSystem.Editor; From 56527d619aa0787e8d6ec88417bf4452a762d67d Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 28 Aug 2025 12:29:53 +0200 Subject: [PATCH 06/15] Add IsNullOrEmpty check as GetAsset can return null. --- .../InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs index 920ff68794..d8e48cb043 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs @@ -70,7 +70,7 @@ public Context(InputActionAsset asset, private string GetAssetReference() { var path = AssetDatabase.GetAssetPath(asset); - if (path == string.Empty) + if (string.IsNullOrEmpty(path)) { return asset.name; } From 8ca84f40f0656668c6ad60c35ca6e32ae3ffbbc1 Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 28 Aug 2025 13:06:22 +0200 Subject: [PATCH 07/15] Update code to reflect code reivew changes. --- .../Plugins/InputForUI/InputActionAssetVerifier.cs | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs index d8e48cb043..35218fe688 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs @@ -70,11 +70,7 @@ public Context(InputActionAsset asset, private string GetAssetReference() { var path = AssetDatabase.GetAssetPath(asset); - if (string.IsNullOrEmpty(path)) - { - return asset.name; - } - return path; + return string.IsNullOrEmpty(path) ? asset.name : path; } private void ActionMapWarning(string actionMap, string problem) From 76f607165e2fbf3269b925096af6ec9560094f41 Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 28 Aug 2025 13:37:39 +0200 Subject: [PATCH 08/15] Fix changelog spacing. --- Packages/com.unity.inputsystem/CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Packages/com.unity.inputsystem/CHANGELOG.md b/Packages/com.unity.inputsystem/CHANGELOG.md index 1b64120835..1944022690 100644 --- a/Packages/com.unity.inputsystem/CHANGELOG.md +++ b/Packages/com.unity.inputsystem/CHANGELOG.md @@ -30,7 +30,7 @@ however, it has to be formatted properly to pass verification tests. ### Fixed - Fixed an issue where using Pen devices on Android tablets would result in double clicks for UI interactions. [ISXB-1456](https://issuetracker.unity3d.com/product/unity/issues/guid/ISXB-1456) - Fixed an issue preventing an embedded platform from being released. It adds back some `#defines` to `XRSupport` and `InputDeviceCharacteristics`. -- Fixed a warning not showing the asset name correctly when the input action map parameters for runtime GUI were not setup.[ISXB-1560] +- Fixed a warning not showing the asset name correctly when the input action map parameters for runtime GUI were not setup. [ISXB-1560] ## [1.14.1] - 2025-07-10 From ba8fc2994255fdd41962afb2a85e197dbcc77054 Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 28 Aug 2025 13:56:48 +0200 Subject: [PATCH 09/15] Add fix to only not show warnings when the UI action map is missing. --- .../Plugins/InputForUI/InputActionAssetVerifier.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs index 35218fe688..193e900425 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs @@ -32,6 +32,11 @@ static InputActionAssetVerifier() public void Verify(InputActionAsset asset, ProjectWideActionsAsset.IReportInputActionAssetVerificationErrors reporter) { + if (asset.FindActionMap("UI", false) == null) + { + return; + } + // Note: // PWA has initial state check true for "Point" action, DefaultActions do not, does it matter? // @@ -92,10 +97,6 @@ public void Verify(string actionNameOrId, InputActionType actionType, string exp // Check if the map (if any) exists var noMapOrMapExists = true; - if (asset.actionMaps.Count == 0) - { - return; - } var index = actionNameOrId.IndexOf('/'); if (index > 0) From 8d7373e8ac9f01aaabd2b6fd8dda165f109ccaab Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 28 Aug 2025 14:03:32 +0200 Subject: [PATCH 10/15] Remove added whitespace. --- .../InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs index 193e900425..5f1b9f535f 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs @@ -97,7 +97,6 @@ public void Verify(string actionNameOrId, InputActionType actionType, string exp // Check if the map (if any) exists var noMapOrMapExists = true; - var index = actionNameOrId.IndexOf('/'); if (index > 0) { From 4cbf7ecc81dd2e3469010c72bf21a0293ad0297c Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 28 Aug 2025 14:04:53 +0200 Subject: [PATCH 11/15] Add comment to explain the early return when not finding a UI action map. --- .../InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs b/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs index 5f1b9f535f..a8176460df 100644 --- a/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs +++ b/Packages/com.unity.inputsystem/InputSystem/Plugins/InputForUI/InputActionAssetVerifier.cs @@ -32,6 +32,7 @@ static InputActionAssetVerifier() public void Verify(InputActionAsset asset, ProjectWideActionsAsset.IReportInputActionAssetVerificationErrors reporter) { + // We don't want to log warnings if no UI action map is present as we default in this case. if (asset.FindActionMap("UI", false) == null) { return; From c4306ad6f2099a81ac70dad4953264accd16fc53 Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Thu, 28 Aug 2025 16:14:09 +0200 Subject: [PATCH 12/15] Add unit tests for testing against warnings that should be shown if actions are missing from the UI action map. --- .../InputSystem/Plugins/InputForUITests.cs | 26 ++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/Assets/Tests/InputSystem/Plugins/InputForUITests.cs b/Assets/Tests/InputSystem/Plugins/InputForUITests.cs index 983703be7e..8efdfe626d 100644 --- a/Assets/Tests/InputSystem/Plugins/InputForUITests.cs +++ b/Assets/Tests/InputSystem/Plugins/InputForUITests.cs @@ -14,6 +14,7 @@ using UnityEngine.InputSystem.Editor; #endif using UnityEngine.InputSystem.Plugins.InputForUI; +using UnityEngine.InputSystem.Utilities; using Event = UnityEngine.InputForUI.Event; using EventProvider = UnityEngine.InputForUI.EventProvider; using Is = NUnit.Framework.Is; @@ -535,10 +536,9 @@ public void DefaultActions_ShouldNotGenerateAnyVerificationWarnings(bool useProj LogAssert.NoUnexpectedReceived(); } - [Ignore("We currently allow a PWA asset without an UI action map and rely on defaults instead. This allows users that do not want it or use something else to avoid using it.")] - [Test(Description = "Verifies that user-supplied project-wide input actions generates warnings if action map is missing.")] + [Test(Description = "Verifies that user-supplied project-wide actions do not generate warnings if action map is missing. We use default actions in this case.")] [Category(kTestCategory)] - public void ActionsWithoutUIMap_ShouldGenerateWarnings() + public void ActionsWithoutUIMap_ShouldNotGenerateWarnings() { var asset = ProjectWideActionsAsset.CreateDefaultAssetAtPath(kAssetPath); asset.RemoveActionMap(asset.FindActionMap("UI", throwIfNotFound: true)); @@ -546,8 +546,24 @@ public void ActionsWithoutUIMap_ShouldGenerateWarnings() InputSystem.s_Manager.actions = asset; Update(); + LogAssert.NoUnexpectedReceived(); + } + + [Test(Description = "Verifies that user-supplied project-wide input actions generates warnings if the UI map is present but actions are missing.")] + [Category(kTestCategory)] + public void ActionsWithUIMap_MissingActions_ShouldGenerateWarnings() + { + var asset = ProjectWideActionsAsset.CreateDefaultAssetAtPath(kAssetPath); + var uiActionMap = asset.FindActionMap("UI", true); + for (int i = uiActionMap.m_Actions.Length - 1; i >= 0; i--) + { + ArrayHelpers.EraseAt(ref uiActionMap.m_Actions, uiActionMap.m_Actions.Length - 1); + } + + InputSystem.s_Manager.actions = asset; + Update(); + var link = EditorHelpers.GetHyperlink(kAssetPath); - LogAssert.Expect(LogType.Warning, new Regex($"^InputActionMap with path 'UI' in asset '{link}' could not be found.")); if (InputActionAssetVerifier.DefaultReportPolicy == InputActionAssetVerifier.ReportPolicy.ReportAll) { LogAssert.Expect(LogType.Warning, new Regex($"^InputAction with path 'UI/Point' in asset '{link}' could not be found.")); @@ -559,8 +575,6 @@ public void ActionsWithoutUIMap_ShouldGenerateWarnings() LogAssert.Expect(LogType.Warning, new Regex($"^InputAction with path 'UI/RightClick' in asset '{link}' could not be found.")); LogAssert.Expect(LogType.Warning, new Regex($"^InputAction with path 'UI/ScrollWheel' in asset '{link}' could not be found.")); } - // else: expect suppression of child errors - LogAssert.NoUnexpectedReceived(); } [Test(Description = "Verifies that user-supplied project-wide input actions generates warnings if any required action is missing.")] From 62301afd160b3d033da53ff0ea683d8598b7dbbb Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Fri, 29 Aug 2025 11:54:58 +0200 Subject: [PATCH 13/15] Change test to have an empty action map in a better way. --- Assets/Tests/InputSystem/Plugins/InputForUITests.cs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/Assets/Tests/InputSystem/Plugins/InputForUITests.cs b/Assets/Tests/InputSystem/Plugins/InputForUITests.cs index 8efdfe626d..34aa902aa0 100644 --- a/Assets/Tests/InputSystem/Plugins/InputForUITests.cs +++ b/Assets/Tests/InputSystem/Plugins/InputForUITests.cs @@ -554,11 +554,8 @@ public void ActionsWithoutUIMap_ShouldNotGenerateWarnings() public void ActionsWithUIMap_MissingActions_ShouldGenerateWarnings() { var asset = ProjectWideActionsAsset.CreateDefaultAssetAtPath(kAssetPath); - var uiActionMap = asset.FindActionMap("UI", true); - for (int i = uiActionMap.m_Actions.Length - 1; i >= 0; i--) - { - ArrayHelpers.EraseAt(ref uiActionMap.m_Actions, uiActionMap.m_Actions.Length - 1); - } + asset.RemoveActionMap(asset.FindActionMap("UI", throwIfNotFound: true)); + asset.AddActionMap(new InputActionMap("UI")); // An empty UI map should log warnings. InputSystem.s_Manager.actions = asset; Update(); From b5ee4fff472f4a2f7355447b99c3ab9ae3e28911 Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Fri, 29 Aug 2025 12:05:23 +0200 Subject: [PATCH 14/15] Remove redundant using. --- Assets/Tests/InputSystem/Plugins/InputForUITests.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/Assets/Tests/InputSystem/Plugins/InputForUITests.cs b/Assets/Tests/InputSystem/Plugins/InputForUITests.cs index 34aa902aa0..69699aec83 100644 --- a/Assets/Tests/InputSystem/Plugins/InputForUITests.cs +++ b/Assets/Tests/InputSystem/Plugins/InputForUITests.cs @@ -14,7 +14,6 @@ using UnityEngine.InputSystem.Editor; #endif using UnityEngine.InputSystem.Plugins.InputForUI; -using UnityEngine.InputSystem.Utilities; using Event = UnityEngine.InputForUI.Event; using EventProvider = UnityEngine.InputForUI.EventProvider; using Is = NUnit.Framework.Is; From 6d0f19d88c66dd4451878fa3931b33df554e7690 Mon Sep 17 00:00:00 2001 From: Darren Kelly Date: Mon, 1 Sep 2025 11:19:45 +0200 Subject: [PATCH 15/15] Fix formatting for InputForUITests. --- Assets/Tests/InputSystem/Plugins/InputForUITests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Assets/Tests/InputSystem/Plugins/InputForUITests.cs b/Assets/Tests/InputSystem/Plugins/InputForUITests.cs index 69699aec83..7deb3e95c4 100644 --- a/Assets/Tests/InputSystem/Plugins/InputForUITests.cs +++ b/Assets/Tests/InputSystem/Plugins/InputForUITests.cs @@ -547,7 +547,7 @@ public void ActionsWithoutUIMap_ShouldNotGenerateWarnings() LogAssert.NoUnexpectedReceived(); } - + [Test(Description = "Verifies that user-supplied project-wide input actions generates warnings if the UI map is present but actions are missing.")] [Category(kTestCategory)] public void ActionsWithUIMap_MissingActions_ShouldGenerateWarnings()