-
Couldn't load subscription status.
- Fork 328
FIX: ISXB-1584, ISXB-1688, ISXB-1692, ISXB-1693, ISXB-1694, ISXB-1701 InputActionReference bug fixes and improved test coverage. #2248
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…been called and cached, then Set and then calling action again.
|
This solves the incorrect return value, but it seems it is not enough to solve the reported problem so moving this back to draft mode for more work. |
…onReference, simplification of InputActionImporter.
…g fixing of InputActionReference, added more tests.
…to support serialization within editor test. Added test utilities.
…echnologies/InputSystem into isxb-1584-input-action-reference
…ork since referencing editor types.
Got it. It works, thanks. For some reasons it didn't work before (maybe I had the project with asset already changed by using .Set() without these changes) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm approving now that I managed to solve the customer issue. Good work.
This is a small change in behavior so I think we should communicate this somehow in a Discussions post. I can already predict more bugs related to this change.
Awesome, yeah I found that if you enter playmode once with the repro project you have corrupted the asset beyond what can be resolved by reimport or action editor changes. |
Would probably make sense to provide an example with the release post. Regardless, the existing behaviour is clearly faulty so at least IMO this improves things and leads to less suprises with corrupt assets or cross-asset references. |
|
Hmmm..... maybe this still causes errors on 2021.3 since that version wouldn't have PWA define |
Confirmed, property drawer is mutating reference via serialised property when used on Unity versions where PWA isn't supported (rather SearchProvider isn't supported), a custom property drawer is also needed before that to not corrupt assets. Will add an update to this PR. |
…ch API and project-wide actions were introduced. Minor test cleanup.
Addressed in 9c7cb44 |
|
@ekcoh as a sanity check, I would check with packages like XR and Cinemachine if they have any immediate problems with this change. |
Good idea. I am have reached out in appropriate internal channels to see if additional feedback can be collected. |
Moved entries to the Unreleased version in CHANGELOG.md since merge had put them in the wrong place.
|
According to @windxu88 the Ubuntu instability is expected in CI at the moment |
|
Been looking at this on and off for a while and it seems fine so far. Still looking into it but got minor notes:
|
Cinemachine team confirmed it doesn't seem to cause any issues with Cinemachine. |
Thanks for the feedback. I look into making that exception message better.
No, it's about doing it programmatically and I have covered it with an automated test that failed when implemented. Then fixed the issue. It's not fundamentally different, but I decided to see ISXB-1584 as the reported problem, that the action wasn't properly updated. This particular one is about corrupting it. There was many things happening at once in 1584 and I just filed specific tickets per problem. This one refers to the part that if you run the repro project without these changes after exiting playmode the first asset (originally containing A), will contain a reference pointing to an action within the asset containing B. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, things checked:
- each ticket's repro steps
- adding it to a big internal project (kinwarton) and testing its functionality
- exploratory testing around using/deleting/setting action references in various scenarios. (Such as: using project wide actions assets for references and making changes to it, using multiple references pointing to the same thing and then making changes, domain reload enabled/disabled testing)
…ption message when attempting to use Set on a reference backed by a .inputactions
|
@Pauliusd01 Attempted to improve exception message in 3b9cceb |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These changes did not seem to negatively impact XRI during my testing.
Description
Fixes the following issues:
InputActionReference.actionwould return an incorrect (cached) action if set programmatically after the cached instance had been resolved.InputActionSetupExtensions.RemoveAction(action)throws exception if attempting to remove an action that doesn't have any bindings.InputActionReference.Setin playmode corrupts the referenced asset.InputActionReference.Create(null)returns null instead "of a reference object to the given action". If its desirable to assign a reference to null when action is null, one should not call Create to begin with.InputActionReference.Set(null)does not update the cached input action reference nor theScriptableObject.nameleading to incorrect action being returned and reference showing up as the path to the previously assigned action in Inspector.ISXB-1699 -This was a misinterpretation and have been reverted. Ticket marked "As Designed".InputActionAsset.RemoveActionMapdoesn't remove actions within the map, leaving them with stale references back to the map.InputActionReferenceisn't reflecting broken reference in case action is deleted from asset, action map is deleted from asset or the asset itself is deleted.Revisiting/altering fixes of the previous tickets:
The above revisited tickets reference the problem of InputActionReference run-time objects not being reset when exiting play-mode with domain reloads disabled. To get this scenario covered, this scenario is now included in the added editor tests. Tested both with and without domain reloads enabled.
Additional changes made:
InputActionReferencein that class as long as there is no UI to edit it implemented. If such a UI is added later it can easily be converted back toInputActionReference.InputActionReferenceto eliminate name-shadowing warnings. Didn't touch public ones since a parameter rename would be unexpected after API publishing.InputActionReferenceinstances from assets withinInputActionImporter.EditorPrefsTestUtils.cswhich is a test utility to simplify editor tests.CoreTests_Actions_References.cswhich extracts previous and newInputActionReferenceplay-mode tests into their own (partial) file.DumpInputActionReferences.cswhich extends "QA Tools" with ability to dump a list of all input action references (loaded + assets) into the console via QA Tools Unity menu.Open issues/questions to reviewers:
Testing status & QA
Added a bunch of functional tests that replicates the problematic scenarios mentioned above. Both play-mode functional tests as well as edit-mode as well as transitional editor-mode to play-mode and play-mode to edit-mode editor tests were added.
Removed some code related to project-wide-actions in property drawer I believe @jfreire-unity added. I do not think it is needed as a special case anymore and I also think it was incorrect to change the users objects.
Altered a previous play-mode fix by @timkeo but it is essentially intact to previous behavior. I think there is opportunity to change this later to only use Object.FindObjectsByType(true) instead of Resources.FindObjectsByType() as an optimisation after this has landed?
Haven''t tested on 2021.3 which might be behaving differently but I do not know if we should bother since it is soon EoL.
Overall Product Risks
InputActionReferences are used all over the place so this is a serious bug that can have impact, especially on more complex projects.
Comments to reviewers
Recommend double checking the repro project with this fix.
Checklist
Before review:
Changed,Fixed,Addedsections.Actions_CanResolveActionReferenceAndThenSetItToAnotherActionDuring merge:
NEW: ___.FIX: ___.DOCS: ___.CHANGE: ___.RELEASE: 1.1.0-preview.3.After merge: