Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
6c1586c
Add fix for ISXB-1560 warnings issue.
Darren-Kelly-Unity Aug 27, 2025
2efad11
Fix issue with all warning log's being shown when they shouldn't be.
Darren-Kelly-Unity Aug 28, 2025
bcae7e7
Update the changelog.
Darren-Kelly-Unity Aug 28, 2025
0778d3e
Fix incorrect check caused by moving code while refactoring.
Darren-Kelly-Unity Aug 28, 2025
284d736
Remove redundant using.
Darren-Kelly-Unity Aug 28, 2025
56527d6
Add IsNullOrEmpty check as GetAsset can return null.
Darren-Kelly-Unity Aug 28, 2025
e74d53f
Merge branch 'develop' into bugfix/ISXB-1560-inputactionmap-warnings
Darren-Kelly-Unity Aug 28, 2025
8ca84f4
Update code to reflect code reivew changes.
Darren-Kelly-Unity Aug 28, 2025
76f6071
Fix changelog spacing.
Darren-Kelly-Unity Aug 28, 2025
ba8fc29
Add fix to only not show warnings when the UI action map is missing.
Darren-Kelly-Unity Aug 28, 2025
8d7373e
Remove added whitespace.
Darren-Kelly-Unity Aug 28, 2025
4cbf7ec
Add comment to explain the early return when not finding a UI action …
Darren-Kelly-Unity Aug 28, 2025
c4306ad
Add unit tests for testing against warnings that should be shown if a…
Darren-Kelly-Unity Aug 28, 2025
62301af
Change test to have an empty action map in a better way.
Darren-Kelly-Unity Aug 29, 2025
b5ee4ff
Remove redundant using.
Darren-Kelly-Unity Aug 29, 2025
6d0f19d
Fix formatting for InputForUITests.
Darren-Kelly-Unity Sep 1, 2025
765ee06
Merge branch 'develop' into bugfix/ISXB-1560-inputactionmap-warnings
Darren-Kelly-Unity Sep 1, 2025
4a697c3
Merge branch 'develop' into bugfix/ISXB-1560-inputactionmap-warnings
Darren-Kelly-Unity Sep 4, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 20 additions & 6 deletions Assets/Tests/InputSystem/Plugins/InputForUITests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -535,19 +536,34 @@ 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));

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--)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried using Clear here instead but it didn't work / caused exceptions.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what you try to test here? Based on the name it sounds like it's a duplicate of my previous test ActionMapWithNonExistentRequiredAction_ShouldGenerateWarning? Maybe you are good with any additional tests? (Check test coverage)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this should just go?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, in this case. It's similar to your old test but the difference is we leave the UI map in and delete the contents.

This should show warnings as me & Paulius talked about this, the default is not used in a case where the UI map is present but not containing necessary actions.

Which is what I test for here.

{
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."));
Expand All @@ -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();
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Had an issue here with Teardown logging the warnings again causing the logs to be there twice and fail.

If you think I should do this another way let me know.

}

[Test(Description = "Verifies that user-supplied project-wide input actions generates warnings if any required action is missing.")]
Expand Down
1 change: 1 addition & 0 deletions Packages/com.unity.inputsystem/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +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]

## [1.14.1] - 2025-07-10

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ 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;
}

// Note:
// PWA has initial state check true for "Point" action, DefaultActions do not, does it matter?
//
Expand Down Expand Up @@ -70,7 +76,7 @@ public Context(InputActionAsset asset,
private string GetAssetReference()
{
var path = AssetDatabase.GetAssetPath(asset);
return path ?? asset.name;
return string.IsNullOrEmpty(path) ? asset.name : path;
}

private void ActionMapWarning(string actionMap, string problem)
Expand Down