Skip to content

FIX: uum 138143 button press points for stickcontrol and vector2 add functionality#2411

Open
Darren-Kelly-Unity wants to merge 62 commits into
developfrom
bugfix/uum-138143-button-press-points-for-stickcontrol-and-vector2-add-functionality
Open

FIX: uum 138143 button press points for stickcontrol and vector2 add functionality#2411
Darren-Kelly-Unity wants to merge 62 commits into
developfrom
bugfix/uum-138143-button-press-points-for-stickcontrol-and-vector2-add-functionality

Conversation

@Darren-Kelly-Unity
Copy link
Copy Markdown
Collaborator

@Darren-Kelly-Unity Darren-Kelly-Unity commented Apr 29, 2026

Purpose of this PR

Purpose of this PR
This change fixes inconsistent press detection between action-level helpers (InputAction.IsPressed, WasPressedThisFrame, WasReleasedThisFrame) and bindings that use a Press interaction with its own pressPoint. Previously, those APIs could use a ButtonControl’s pressPoint while the interaction used a different threshold, so “pressed” could disagree with the interaction’s press/release behavior.

It also aligns Vector2 / stick bindings with the intended model: action-level press polling uses InputSettings.defaultButtonPressPoint unless a Press interaction sets an explicit threshold (no separate per-vector pressPoint on the composite control for this path).

Tracking: UUM-138143 (adjust link if your team uses Jira instead of Issue Tracker).

Docs touched: RespondingToActions.md, Interactions.md; implementation in InputAction, InputActionState, InputControlExtensions, ButtonControl, PressInteraction, StickControl (XML remarks), plus focused tests in ActuationPressPointTests and updates in CoreTests_Actions / CoreTests_Controls.

Release Notes

Release Notes
Fixed: InputAction.IsPressed, WasPressedThisFrame, and WasReleasedThisFrame now respect a binding’s Press interaction pressPoint when set, so they stay consistent with the interaction’s press and release behavior instead of always following the bound ButtonControl’s pressPoint when both are set. UUM-138143
Changed: For bindings to Vector2 / stick controls, action-level press APIs no longer use a per-control pressPoint on the vector; use a Press interaction for a custom threshold or rely on defaultButtonPressPoint. UUM-138143

Functional Testing status

  • Automated: new ActuationPressPointTests and updates in CoreTests_Actions / CoreTests_Controls cover press-point actuation paths.
  • Manual: repro project IN-136917 / scene Input Bug from the ticket; verify console no longer shows IsPressed before processed magnitude reaches the configured press threshold for vector / stick cases.

Performance Testing Status

I have added performance testing for the hot path methods that Hakan flagged and I don't see any major issues when comparing. There is a slight increase in cost of performance of about 0.1ms for 1000 iterations on the GetActuationPressThreshold() method that was asked to be checked.

No new per-frame allocations identified in scope.

Overall Product Risks

Technical Risk: 2 — Touches core action state, actuation thresholds, and several control paths; behavior change for anyone relying on the old mismatch or on vector-level pressPoint for these APIs.

Halo Effect: 2 — Affects any project using Press + custom pressPoint with IsPressed / frame-edge helpers, and Vector2/stick bindings that assumed the old threshold source.

Documentation Impact

Changes analyzed: origin/develop...HEAD (4 commits).

User-facing: New public IActuationPressPoint; InputAction press-helper remarks/behavior; ButtonControl, Vector2Control, StickControl docs around pressPoint; RespondingToActions.md updated for polling vs pressPoint.

Documentation updates in this PR

  • RespondingToActions.md — Clarifies IsPressed / frame helpers vs interactions and pressPoint; review wording and cross-refs after merge.

Follow-up (optional)

  • If QA/docs want a dedicated IActuationPressPoint callout in a control reference page, add a short subsection and link from Responding to Actions.

Jira (fetched via MCP): Bug, In Progress, TBD priority, assignee Darren Kelly, label Input-Actions. Ticket summary: InputAction.IsPressed() and IsInProgress() triggers on wrong values when rewriting the default values of Vector2 interactions.

@u-pr
Copy link
Copy Markdown
Contributor

u-pr Bot commented Apr 29, 2026

⚠️ Review skipped — this PR is too large to process.

The diff contains approximately 325,668 tokens (~977,005 characters), which exceeds the maximum limit of 150,000 tokens.

Please consider splitting this PR into smaller, focused changes.

🤖 Helpful? 👍/👎

@codecov-github-com
Copy link
Copy Markdown

codecov-github-com Bot commented Apr 29, 2026

Codecov Report

Attention: Patch coverage is 80.98592% with 81 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
...sets/Tests/InputSystem/ActuationPressPointTests.cs 70.67% 78 Missing ⚠️
Assets/Tests/InputSystem/CoreTests_Actions.cs 97.24% 3 Missing ⚠️
@@             Coverage Diff             @@
##           develop    #2411      +/-   ##
===========================================
+ Coverage    78.13%   78.94%   +0.81%     
===========================================
  Files          483      756     +273     
  Lines        98770   139174   +40404     
===========================================
+ Hits         77169   109866   +32697     
- Misses       21601    29308    +7707     
Flag Coverage Δ
inputsystem_MacOS_6000.0 5.32% <0.00%> (+0.01%) ⬆️
inputsystem_MacOS_6000.0_project 77.28% <79.49%> (-0.02%) ⬇️
inputsystem_MacOS_6000.3_project 77.28% <79.49%> (+<0.01%) ⬆️
inputsystem_MacOS_6000.4 5.33% <0.00%> (+0.01%) ⬆️
inputsystem_MacOS_6000.4_project 77.29% <79.49%> (+<0.01%) ⬆️
inputsystem_MacOS_6000.5 5.32% <0.00%> (+0.01%) ⬆️
inputsystem_MacOS_6000.5_project 77.32% <79.49%> (+<0.01%) ⬆️
inputsystem_MacOS_6000.6 5.32% <0.00%> (+0.01%) ⬆️
inputsystem_MacOS_6000.6_project 77.32% <79.49%> (+0.01%) ⬆️
inputsystem_Ubuntu_6000.0 5.33% <0.00%> (+0.01%) ⬆️
inputsystem_Ubuntu_6000.0_project 77.19% <79.49%> (-0.02%) ⬇️
inputsystem_Ubuntu_6000.3 5.33% <0.00%> (+0.01%) ⬆️
inputsystem_Ubuntu_6000.3_project 77.18% <79.49%> (+<0.01%) ⬆️
inputsystem_Ubuntu_6000.4 5.33% <0.00%> (+0.01%) ⬆️
inputsystem_Ubuntu_6000.4_project 77.20% <79.49%> (+<0.01%) ⬆️
inputsystem_Ubuntu_6000.5 5.32% <0.00%> (+0.01%) ⬆️
inputsystem_Ubuntu_6000.5_project 77.23% <79.49%> (+<0.01%) ⬆️
inputsystem_Ubuntu_6000.6 5.32% <0.00%> (+0.01%) ⬆️
inputsystem_Ubuntu_6000.6_project 77.23% <79.49%> (+0.01%) ⬆️
inputsystem_Windows_6000.0 5.32% <0.00%> (+0.01%) ⬆️
inputsystem_Windows_6000.0_project 77.40% <79.49%> (-0.02%) ⬇️
inputsystem_Windows_6000.3 5.32% <0.00%> (+0.01%) ⬆️
inputsystem_Windows_6000.3_project 77.40% <79.49%> (+<0.01%) ⬆️
inputsystem_Windows_6000.4 5.33% <0.00%> (+0.01%) ⬆️
inputsystem_Windows_6000.4_project 77.41% <79.49%> (+<0.01%) ⬆️
inputsystem_Windows_6000.5 5.32% <0.00%> (+0.01%) ⬆️
inputsystem_Windows_6000.6 5.32% <0.00%> (+0.01%) ⬆️
inputsystem_Windows_6000.6_project 77.45% <79.49%> (+<0.01%) ⬆️

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

Files with missing lines Coverage Δ
Assets/Tests/InputSystem/CoreTests_Controls.cs 99.80% <100.00%> (-0.02%) ⬇️
...tsystem/InputSystem/Runtime/Actions/InputAction.cs 92.81% <100.00%> (ø)
...em/InputSystem/Runtime/Actions/InputActionState.cs 92.41% <100.00%> (ø)
...m/Runtime/Actions/Interactions/PressInteraction.cs 88.60% <ø> (ø)
...stem/InputSystem/Runtime/Controls/ButtonControl.cs 88.23% <ø> (ø)
...tSystem/Runtime/Controls/InputControlExtensions.cs 76.12% <100.00%> (ø)
...ystem/InputSystem/Runtime/Controls/StickControl.cs 100.00% <ø> (ø)
Assets/Tests/InputSystem/CoreTests_Actions.cs 98.89% <97.24%> (+0.48%) ⬆️
...sets/Tests/InputSystem/ActuationPressPointTests.cs 70.67% <70.67%> (ø)

... and 256 files with indirect coverage changes

ℹ️ Need help interpreting these results?

@Darren-Kelly-Unity Darren-Kelly-Unity changed the title Bugfix/uum 138143 button press points for stickcontrol and vector2 add functionality FIX: uum 138143 button press points for stickcontrol and vector2 add functionality Apr 29, 2026
…-stickcontrol-and-vector2-add-functionality

# Conflicts:
#	Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/InputControlExtensions.cs
Copy link
Copy Markdown
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.

@Darren-Kelly-Unity Would it be possible to get rid of all the whitespace diffs on this PR? It would be much easier to review if this was corrected.

Comment thread Packages/com.unity.inputsystem/InputSystem/Runtime/Actions/InputAction.cs Outdated
Comment thread Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/ButtonControl.cs Outdated
Comment thread Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/ButtonControl.cs Outdated
Copy link
Copy Markdown
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.

Reviewed, I had quite a lot of questions and some remaining from last review so leaving this as comment-only for now.

Comment thread Packages/com.unity.inputsystem/InputSystem/Controls/IActuationPressPoint.cs Outdated
Comment thread Packages/com.unity.inputsystem/InputSystem/Controls/IActuationPressPoint.cs Outdated
Comment thread Packages/com.unity.inputsystem/InputSystem/Runtime/Actions/InputActionState.cs Outdated
Comment thread Packages/com.unity.inputsystem/InputSystem/Runtime/Actions/InputActionState.cs Outdated
Comment thread Packages/com.unity.inputsystem/InputSystem/Runtime/Actions/InputActionState.cs Outdated
Comment thread Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/Vector2Control.cs Outdated
Comment thread Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/Vector2Control.cs Outdated
…ctor2Control.cs

Co-authored-by: Håkan Sidenvall <hakan.sidenvall@unity3d.com>
Darren-Kelly-Unity and others added 7 commits May 18, 2026 13:08
…ons.md

Co-authored-by: Sue Arkin <85237015+suearkinunity@users.noreply.github.com>
…ons.md

Co-authored-by: Sue Arkin <85237015+suearkinunity@users.noreply.github.com>
…ctor2Control.cs

Co-authored-by: Morgan Hoarau <122548697+MorganHoarau@users.noreply.github.com>
@Darren-Kelly-Unity Darren-Kelly-Unity requested a review from ekcoh May 19, 2026 15:22
Copy link
Copy Markdown
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.

Reducing interface to a single method makes a lot of sense. Added some remaining suggestions/questions - once those are sorted I will approve this PR.

Comment thread Packages/com.unity.inputsystem/InputSystem/Runtime/Actions/InputActionState.cs Outdated
Comment thread Packages/com.unity.inputsystem/InputSystem/Runtime/Actions/InputActionState.cs Outdated
Comment thread Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/Vector2Control.cs Outdated
Comment thread Packages/com.unity.inputsystem/InputSystem/Runtime/Controls/Vector2Control.cs Outdated
Copy link
Copy Markdown
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.

Discussed some simplifications to be done before. Will approve now to unblock.

@Darren-Kelly-Unity
Copy link
Copy Markdown
Collaborator Author

/review

@u-pr
Copy link
Copy Markdown
Contributor

u-pr Bot commented May 20, 2026

PR Reviewer Guide 🔍

(Review updated until commit a73b5f5)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪

The PR is moderate in size, mixes runtime behavior changes with extensive test updates, and the press-threshold semantics require careful reasoning across actions, controls, and composites.

🏅 Score: 92

The change is well-covered by focused tests and the runtime updates appear internally consistent, with no clear bugs or security issues evident in the diff.

🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

  • Update review

🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr

@Darren-Kelly-Unity
Copy link
Copy Markdown
Collaborator Author

PR Reviewer Guide 🔍

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
Medium effort: the PR has extensive test churn, but the core behavior change is concentrated in the action press-threshold resolution logic.

🏅 Score: 84
The change is well tested and targeted, but the new threshold-selection rule can still make action-level press polling disagree with supported stacked Press interactions.

🧪 PR contains tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Threshold mismatch
Skipping earlier PressInteraction entries whose pressPoint is left at the default 0 can still desynchronize action-level helpers from interaction behavior. For example, with interactions: "press,press(pressPoint=0.8)", the first interaction will press at the default threshold, but IsPressed/WasPressedThisFrame will stay false until 0.8 because this scan ignores the first PressInteraction. That reintroduces the inconsistency this change is trying to remove for valid stacked-press setups.

var count = bindingForInteractions->interactionCount;
if (count > 0)
{
    var start = bindingForInteractions->interactionStartIndex;
    for (var i = 0; i < count; ++i)
    {
        if (interactions[start + i] is PressInteraction press && press.pressPoint > 0)
        {
            return press.pressPoint;
  • Update review

🤖 Helpful? Please react with 👍/👎 | Questions❓Please reach out in Slack #ask-u-pr

I have checked this & ran it through an AI check too. This is not completely true what's said and it's documented for this case also.

@u-pr
Copy link
Copy Markdown
Contributor

u-pr Bot commented May 21, 2026

Persistent review updated to latest commit a73b5f5

@Pauliusd01 Pauliusd01 self-requested a review May 21, 2026 11:26
Comment thread Packages/com.unity.inputsystem/InputSystem/Runtime/Actions/InputAction.cs Outdated
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.

6 participants