Skip to content

Conversation

@Darren-Kelly-Unity
Copy link
Collaborator

@Darren-Kelly-Unity Darren-Kelly-Unity commented Aug 28, 2025

Description

Fix the warning being shown when no InputActionMap is setup properly. There was a missing file name in the warning.
I also now only show the warning if there is an action map as we default when there isn't one at all, therefore we don't need the warning.

Ticket
https://jira.unity3d.com/browse/ISXB-1560

Testing status & QA

I have tested manually I recommend QA does the same. Following the repro steps in the ticket.

Overall Product Risks

Please rate the potential complexity and halo effect from low to high for the reviewers. Note down potential risks to specific Editor branches if any.

  • Complexity: 1
  • Halo Effect: 1

Comments to reviewers

Nothing major to comment.

Checklist

Before review:

  • Changelog entry added.
    • Explains the change in Changed, Fixed, Added sections.
    • For API change contains an example snippet and/or migration example.
    • JIRA ticket linked, example (case %%). If it is a private issue, just add the case ID without a link.
    • Jira port for the next release set as "Resolved".
  • Tests added/changed, if applicable.
    • Functional tests Area_CanDoX, Area_CanDoX_EvenIfYIsTheCase, Area_WhenIDoX_AndYHappens_ThisIsTheResult.
    • Performance tests.
    • Integration tests.
  • Docs for new/changed API's.
    • Xmldoc cross references are set correctly.
    • Added explanation how the API works.
    • Usage code examples added.
    • The manual is updated, if needed.

During merge:

  • Commit message for squash-merge is prefixed with one of the list:
    • NEW: ___.
    • FIX: ___.
    • DOCS: ___.
    • CHANGE: ___.
    • RELEASE: 1.1.0-preview.3.

After merge:

  • Create forward/backward port if needed. If you are blocked from creating a forward port now please add a task to ISX-1444.

@unity-cla-assistant
Copy link

unity-cla-assistant commented Aug 28, 2025

CLA assistant check
All committers have signed the CLA.

@Darren-Kelly-Unity Darren-Kelly-Unity changed the title isxb 1560 inputactionmap warnings FIX: isxb 1560 inputactionmap warnings Aug 28, 2025
Copy link
Collaborator

@ekcoh ekcoh left a comment

Choose a reason for hiding this comment

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

Thanks for looking into this. Some comments and suggestions....


// Check if the map (if any) exists
var noMapOrMapExists = true;
if (asset.actionMaps.Count == 0)
Copy link
Collaborator

Choose a reason for hiding this comment

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

I do not understand why you are checking this? This code is trying to verify a single action (it's the intended purpose of the method). This method should not verify the asset, only the action within the asset. Additionally, based on the comments in the JIRA case, it seems like the desired outcome is to not generate all warnings when there is no "UI" map (relying on defaults), and not in the general case. If this is the goal with the fix is to disable all action verification when there is no UI map I suggest we remove this and instead add an early return to line #35 in this file. That early return I believe should also check for the presence of an "UI" action map and not check action map count in general. E.g.

if (asset.FindActionMap("UI", false) == null) return;

See https://docs.unity3d.com/Packages/[email protected]/api/UnityEngine.InputSystem.InputActionAsset.html#UnityEngine_InputSystem_InputActionAsset_FindActionMap_System_String_System_Boolean_

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also consider adding a unit test (do not remember if tests for this class exist or not that may be extended) to avoid future regression.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ok got it, I think misunderstood this one, I went by what Paulius said but I didn't understand the first time round from reading the comment. I'll try to check with him to confirm.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, you are right! I understood from the ticket when there is nothing mapped in the input file, when it should have been no UI map there.

I made the change you suggested and now it seems to behave as expected fixing Paulius' issue below also.

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 have now added two unit tests also to test both that warnings are thrown when there are actions missing from the UI action map.

And another so that we do not have any warnings when no UI map exists.

@ekcoh
Copy link
Collaborator

ekcoh commented Aug 28, 2025

I guess the tests checkbox and docs checkbox should not be checked since the PR isn't currently touching any of those areas?

@codecov-github-com
Copy link

codecov-github-com bot commented Aug 28, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

@@           Coverage Diff            @@
##           develop    #2229   +/-   ##
========================================
  Coverage    68.14%   68.14%           
========================================
  Files          367      367           
  Lines        53661    53661           
========================================
  Hits         36567    36567           
  Misses       17094    17094           
Flag Coverage Δ
linux_2021.3_pkg 5.45% <ø> (ø)
linux_2021.3_project 70.40% <ø> (ø)
linux_2022.3_pkg 5.23% <ø> (ø)
linux_2022.3_project 65.24% <ø> (ø)
linux_6000.0_pkg 5.23% <ø> (ø)
linux_6000.0_project 68.05% <ø> (+0.01%) ⬆️
linux_6000.2_pkg 5.23% <ø> (ø)
linux_6000.2_project 68.05% <ø> (+0.01%) ⬆️
linux_trunk_pkg 5.24% <ø> (ø)
linux_trunk_project 68.05% <ø> (+0.01%) ⬆️
mac_2021.3_pkg 5.45% <ø> (ø)
mac_2021.3_project 70.41% <ø> (ø)
mac_2022.3_pkg 5.22% <ø> (ø)
mac_2022.3_project 65.27% <ø> (ø)
mac_6000.0_pkg 5.23% <ø> (ø)
mac_6000.0_project 68.07% <ø> (ø)
mac_6000.2_pkg 5.23% <ø> (ø)
mac_6000.2_project 68.07% <ø> (+0.01%) ⬆️
mac_trunk_pkg 5.23% <ø> (ø)
mac_trunk_project 68.07% <ø> (+0.01%) ⬆️
win_2021.3_pkg 5.45% <ø> (ø)
win_2021.3_project 70.48% <ø> (ø)
win_2022.3_pkg 5.23% <ø> (ø)
win_2022.3_project 65.34% <ø> (ø)
win_6000.0_pkg 5.23% <ø> (ø)
win_6000.0_project 68.15% <ø> (+0.01%) ⬆️
win_6000.2_pkg 5.23% <ø> (ø)
win_6000.2_project 68.14% <ø> (+<0.01%) ⬆️
win_trunk_pkg 5.23% <ø> (ø)
win_trunk_project 68.14% <ø> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@Pauliusd01

This comment was marked as resolved.

@Darren-Kelly-Unity
Copy link
Collaborator Author

I guess the tests checkbox and docs checkbox should not be checked since the PR isn't currently touching any of those areas?

I actually though initially I shouldn't need to add tests so checked it as I thought about it.

But I saw you left a comment to add a test so I can look into that!

@Darren-Kelly-Unity
Copy link
Collaborator Author

Darren-Kelly-Unity commented Aug 28, 2025

@Pauliusd01, it wouldn't let me quote reply for some reason.

Edit: Nevermind, it was due to my misunderstanding Hakan pointed out. Now everything should work. I pushed a fix.

Copy link
Collaborator

@Pauliusd01 Pauliusd01 left a comment

Choose a reason for hiding this comment

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

LGTM. Checked that the warning is no longer shown when UI map is missing and that it is still shown when the map is partially incomplete. Also, double checked that game UI (UGUI and UIToolkit) still works properly without having a UI map in the project wide actions asset and it does, the warning really was unnecessary in this scenario.

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.

{
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.

Copy link
Collaborator

@ekcoh ekcoh left a comment

Choose a reason for hiding this comment

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

LGTM now. Good work!

@ekcoh
Copy link
Collaborator

ekcoh commented Aug 29, 2025

One small thing, you need to rerun formatter on this PR to get CI green.

Copy link
Collaborator

@ritamerkl ritamerkl left a comment

Choose a reason for hiding this comment

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

LGTM

@jfreire-unity
Copy link
Collaborator

@Darren-Kelly-Unity can you make the PR name more descriptive, please? Just so that the commit makes more sense. Thanks

@Darren-Kelly-Unity Darren-Kelly-Unity changed the title FIX: isxb 1560 inputactionmap warnings FIX: isxb 1560 inputactionmap warnings when the UI map is not setup correctly. Sep 1, 2025
@jfreire-unity jfreire-unity changed the title FIX: isxb 1560 inputactionmap warnings when the UI map is not setup correctly. FIX: InputActionMap warnings when the UI map is not setup correctly (ISXB-1560) Sep 1, 2025
@ekcoh
Copy link
Collaborator

ekcoh commented Sep 3, 2025

Suggested way forward:

  • Need to agree to CLA
  • If this branch is updated with latest develop 6000.1 build targets should go away.

@Darren-Kelly-Unity Darren-Kelly-Unity merged commit f5bf847 into develop Sep 8, 2025
114 checks passed
@Darren-Kelly-Unity Darren-Kelly-Unity deleted the bugfix/ISXB-1560-inputactionmap-warnings branch September 8, 2025 14:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants