Skip to content

Handling InputActionAsset in InputActionTrace#1543

Merged
jimon merged 4 commits intodevelopfrom
dmytro/fix-isxb-29
Oct 28, 2022
Merged

Handling InputActionAsset in InputActionTrace#1543
jimon merged 4 commits intodevelopfrom
dmytro/fix-isxb-29

Conversation

@jimon
Copy link
Copy Markdown
Contributor

@jimon jimon commented Jun 1, 2022

Description

If binding resolution triggers (due to adding new device, etc) when InputActionTrace is used on InputAction from InputActionAsset, we fail with debug exception that the provided object in onActionChange is unexpected.

Because in this case onActionChange is invoked with InputActionAsset object and not InputAction or InputActionMap, which is not handled by InputActionTrace.

Changes made

  • Added branch in InputActionTrace to handle InputActionAsset, and clone all relevant states from the asset.
  • Modified the test to trigger the branch.

Notes

I don't know why we have m_ActionMapStateClones, they don't seem to be used? Are they needed because InputAction indirectly uses memory from them?

@jimon jimon requested review from andrew-oc and jamesmcgill June 1, 2022 12:28
@unity-cla-assistant
Copy link
Copy Markdown

unity-cla-assistant commented Jun 1, 2022

CLA assistant check
All committers have signed the CLA.

Copy link
Copy Markdown
Collaborator

@jamesmcgill jamesmcgill left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Copy Markdown
Contributor

@andrew-oc andrew-oc left a comment

Choose a reason for hiding this comment

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

PR looks fine. Wanted to comment real quick that the m_ActionMapStateClones is needed so we can replay events later against the same set of bindings that were active when the events happened. If we didn't save them, all the binding indices and trigger states indices would potentially be wrong during a replay.

@jimon jimon force-pushed the dmytro/fix-isxb-29 branch from c21434a to d11f511 Compare October 28, 2022 09:37
@jimon jimon merged commit 156bd1f into develop Oct 28, 2022
@jimon jimon deleted the dmytro/fix-isxb-29 branch October 28, 2022 13:28
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.

4 participants