Skip to content

Conversation

bmalrat
Copy link
Collaborator

@bmalrat bmalrat commented Sep 10, 2024

Description

When composite bindings contains multiple interactions the interaction on each sub part could enter a bad state and stop functioning.
The user use case with tap,hold on WASD. stop working after a hold of WD. All subsequent press will be a hold even if it was a tap.

Changes made

  • Removed the instanciation of the interaction on composite part (like shown in the asset editor)
  • don't keep new performed interactions when the trigger is already performed which lead to bad state.

Testing

new test + local testing of the customer project

Risk

Please describe the potential risks of your changes for the reviewers.

Checklist

Before review:

  • [ X] 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".
  • [X ] 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.

@bmalrat bmalrat requested review from Pauliusd01 and ekcoh September 10, 2024 20:54
@bmalrat bmalrat force-pushed the isxb-619-fix-tap-interaction-on-composite-binding branch from b1244fa to 7a8dcc2 Compare September 10, 2024 21:00
@Pauliusd01
Copy link
Collaborator

Pauliusd01 commented Sep 12, 2024

Will check this today tomorrow

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, god job on figuring this one out, some minor comments.

Assert.That(canceledInteraction, Is.Null);
Assert.That(performedInteraction, Is.Null);

currentTime = 0.01;
Copy link
Collaborator

Choose a reason for hiding this comment

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

performedInteraction = null;

// Long PressRelease AW trigger a hold
currentTime = 1;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Collaborator

Choose a reason for hiding this comment

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

Also fine as is since I would image default would never go that far

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

in the test I initialized hold with hold(duration=2) I will add some comments

// Ensure that https://jira.unity3d.com/browse/ISXB-619 regress
[Test]
[Category("Actions")]
public void Actions_WithCompositeWithMultipleInteractions_Works()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Thanks for writing a test with this quite elaborate sequence which I believe is key to avoid regressive behaviour when there are actually interdependencies between the interaction patterns

// the action. If we go back to waiting here, then the system can't tell that there's another interaction
// ready to perform (in fact, that has already performed).
if (newPhase == InputActionPhase.Performed &&
actionIndex != -1 && !actionStates[actionIndex].isPerformed &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

Minor: Would prefer actionIndex >= 0 for readability.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

changed to use the kInvalidIndex

@Pauliusd01
Copy link
Collaborator

Please check the iOS CI failures

@bmalrat bmalrat merged commit 7a28d7b into develop Sep 13, 2024
77 checks passed
@bmalrat bmalrat deleted the isxb-619-fix-tap-interaction-on-composite-binding branch September 13, 2024 16:08
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.

3 participants