-
Notifications
You must be signed in to change notification settings - Fork 329
FIX: MouseDownEvent is triggered when changing from Scene view to Game view (ISXB-1671) #2234
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
base: develop
Are you sure you want to change the base?
FIX: MouseDownEvent is triggered when changing from Scene view to Game view (ISXB-1671) #2234
Conversation
Codecov ReportAttention: Patch coverage is
@@ Coverage Diff @@
## develop #2234 +/- ##
========================================
Coverage 68.17% 68.17%
========================================
Files 367 367
Lines 53668 53714 +46
========================================
+ Hits 36587 36622 +35
- Misses 17081 17092 +11
Flags with carried forward coverage won't be shown. Click here to find out more.
... and 1 file with indirect coverage changes 🚀 New features to boost your workflow:
|
dc01440
to
f21ad55
Compare
f21ad55
to
6157498
Compare
It's tested against all background behavior settings.
The goal is here is to make those conditions self contained in "chunks" so that we can slightly reduce the cognitive load when reading through the OnUpdate() function. This is a personal preference and others in the team might disagree with these changes.
@@ -642,6 +642,55 @@ public void Actions_DoNotGetTriggeredByEditorUpdates() | |||
} | |||
} | |||
|
|||
[Test] | |||
[Category("Actions")] |
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 still need to add a InputForUI specific test for this.
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 am hesitant introducing such a big change in the InputManager, also looking at it I wonder:
Isn't the wrong event the mousePosition sent from DeviceSync? Since the event before should not cause the MouseDown, but the second event (caused by the DeviceSync). Or did I get that wrong?
Description
Proposed solution to fix ISXB-1671.
The bug reports a UITK event that shouldn't be triggered. This ocurrs due to a
InputSystemProvider
UI Click action being performed once the Editor is in play-mode and we select Game view tab when previously in Scene View.The action that is triggered provides the wrong mouse position. Essentially, an action is being performed for the mouse click/position that happened while out of focus in the Editor and triggered the focus regain. However, when
InputManager.OnUpdate()
is called, it assumes the game already is in focus, so there was no way to know if an event was triggered out of focus or not.The proposed solution is to filter and discard the events that happened immediately before focus was regained, by checking if they were received before the focus regain. In the diagram below, essentially we are discarding the "ofending" event - in red - that triggered an Input Action, which would then dispatch a UITK event through
InputSystemProvider
.Unrelated changes to bug-fix
I also did a small refactoring to put some conditions in their own functions so that can be easier to read through
InputManager.OnUpdate
. This is just a personal preference as it has been historically complicated to reason about all the conditions we have. This is still not perfect, but I hope it's a small improvement for others as well.If you want, you can have a look of the commit which contains the fix changes, 6157498. This doesn't have any refactoring yet and is easier to reason about.
Testing status & QA
Please describe the testing already done by you and what testing you request/recommend QA to execute. If you used or created any testing project please link them here too for QA.
Overall Product Risks
Comments to reviewers
Verify that the original bug doesn't happen anymore, both on Win and macOS.
Do some other tests with changing Background settings, to make sure nothing has regressed. We can likely use on of the Mouse Visualisers for it.
Checklist
Before review:
Changed
,Fixed
,Added
sections.Area_CanDoX
,Area_CanDoX_EvenIfYIsTheCase
,Area_WhenIDoX_AndYHappens_ThisIsTheResult
.During merge:
NEW: ___
.FIX: ___
.DOCS: ___
.CHANGE: ___
.RELEASE: 1.1.0-preview.3
.