Skip to content

FIX: [Port] [UUM-137448] Fixed layout merge for controls declared for several variants - #2505

Merged
josepmariapujol-unity merged 2 commits into
developfrom
backport/input/fix-multi-variant-control-merge
Nov 10, 2026
Merged

josepmariapujol-unity merged 2 commits into
developfrom
backport/input/fix-multi-variant-control-merge

Conversation

@josepmariapujol-unity

@josepmariapujol-unity josepmariapujol-unity commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

Description

Backport of: https://github.cds.internal.unity3d.com/unity/unity/pull/137448

A control declared for "lefty;righty" was stored under custom@lefty and custom@lefty@righty, but never under custom@righty. So a derived layout that overrode it for righty lost the base control's layout, offset, format and usages. The fix builds every lookup key from the control name.

Testing status & QA

New test Layouts_ControlDeclaredForSeveralVariants_MergesUnderEachOfThem.

Overall Product Risks

since it's a one-line change that only affects multi-variant controls in layouts that another layout extends.

  • Complexity: 1
  • Halo Effect: 1

Comments to reviewers

Please describe any additional information such as what to focus on, or historical info for the reviewers.

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.

…or several variants

CreateLookupTableForControls appended each variant to the previous key,
so a control with variants "A;B" was stored under "name@a" and
"name@a@b" but never "name@b". A derived layout overriding the control
for the second variant found nothing to merge with and lost the base
control's layout, offset, format and usages.

Port of input/fix-multi-variant-control-merge from the unity repo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@josepmariapujol-unity josepmariapujol-unity self-assigned this Nov 9, 2026

@u-pr u-pr Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

💡 Harness Review

Ship it

The change correctly builds independent lookup keys for each variant, and the regression test checks inheritance under both variants. I examined the surrounding merge and variant-matching behavior, test setup, and changelog and found no actionable issues.

Reviewed commit 2c43cab

🤖 Helpful? 👍/👎

@josepmariapujol-unity josepmariapujol-unity changed the title FIX: [Port] [Input System] Fixed layout merge for controls declared for several variants FIX: [Port] [UUM-137448] Fixed layout merge for controls declared for several variants Nov 9, 2026
@josepmariapujol-unity josepmariapujol-unity added the bug Issues where existsing functionality misbehaves label Nov 9, 2026
@codecov-github-com

codecov-github-com Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

@@             Coverage Diff             @@
##           develop    #2505      +/-   ##
===========================================
+ Coverage    78.96%   79.21%   +0.24%     
===========================================
  Files          767      769       +2     
  Lines       140949   141263     +314     
===========================================
+ Hits        111305   111898     +593     
+ Misses       29644    29365     -279     
Flag Coverage Δ
inputsystem_MacOS_6000.0 5.31% <0.00%> (+<0.01%) ⬆️
inputsystem_MacOS_6000.0_project 77.88% <100.00%> (+0.37%) ⬆️
inputsystem_MacOS_6000.3 5.31% <0.00%> (+<0.01%) ⬆️
inputsystem_MacOS_6000.3_project 77.88% <100.00%> (+0.37%) ⬆️
inputsystem_MacOS_6000.6 5.30% <0.00%> (+<0.01%) ⬆️
inputsystem_MacOS_6000.6_project 77.94% <100.00%> (+0.37%) ⬆️
inputsystem_Ubuntu_6000.0 5.31% <0.00%> (+<0.01%) ⬆️
inputsystem_Ubuntu_6000.0_project 77.79% <100.00%> (+0.37%) ⬆️
inputsystem_Ubuntu_6000.3 5.32% <0.00%> (+<0.01%) ⬆️
inputsystem_Ubuntu_6000.3_project 77.79% <100.00%> (+0.37%) ⬆️
inputsystem_Ubuntu_6000.6 5.30% <0.00%> (+<0.01%) ⬆️
inputsystem_Ubuntu_6000.6_project 77.85% <100.00%> (+0.38%) ⬆️
inputsystem_Windows_6000.0 5.31% <0.00%> (+<0.01%) ⬆️
inputsystem_Windows_6000.0_project 78.01% <100.00%> (+0.37%) ⬆️
inputsystem_Windows_6000.3 5.31% <0.00%> (+<0.01%) ⬆️
inputsystem_Windows_6000.3_project 78.00% <100.00%> (+0.37%) ⬆️
inputsystem_Windows_6000.6 5.30% <0.00%> (+<0.01%) ⬆️
inputsystem_Windows_6000.6_project 78.07% <100.00%> (+0.37%) ⬆️

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

Files with missing lines Coverage Δ
Assets/Tests/InputSystem/CoreTests_Layouts.cs 91.61% <100.00%> (+0.12%) ⬆️
...InputSystem/Runtime/Controls/InputControlLayout.cs 89.25% <100.00%> (+0.92%) ⬆️

... and 11 files with indirect coverage changes

ℹ️ Need help interpreting these results?

@josepmariapujol-unity

Copy link
Copy Markdown
Collaborator Author
Test Failure: XRIPackageTests.AddingLatestXRIPackageThrowsNoErrors
slack

utr

Timeout value of 180000 ms was exceeded. If this is intended, increase the timeout value using a TimeoutAttribute.

@josepmariapujol-unity

Copy link
Copy Markdown
Collaborator Author

All test pass! 🟢

@josepmariapujol-unity

Copy link
Copy Markdown
Collaborator Author

Given that fix is just one line (table[$"{key}@{name}"] = controlItems[i];).
I'll merge PR

@josepmariapujol-unity
josepmariapujol-unity merged commit 12cb9f1 into develop Nov 10, 2026
70 of 73 checks passed
@josepmariapujol-unity
josepmariapujol-unity deleted the backport/input/fix-multi-variant-control-merge branch November 10, 2026 13:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issues where existsing functionality misbehaves

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant