Fix issue: New Input System - All mouse buttons have the same pointer Id#2071
Open
gapspt wants to merge 2 commits intoUnity-Technologies:developfrom
Open
Fix issue: New Input System - All mouse buttons have the same pointer Id#2071gapspt wants to merge 2 commits intoUnity-Technologies:developfrom
gapspt wants to merge 2 commits intoUnity-Technologies:developfrom
Conversation
… Id" Fixes the following bug: When using the IPointerDownHandler (OnPointerDown method) with the New Input System, the eventData.pointerId is always the same, corresponding to the deviceId. According to the documentation [1] for Unity 2018: "When using a mouse the pointerId returns -1, -2, or -3. These are the left, right and center mouse buttons respectively." I mention the 2018 because the documentation on the standalone Unity UI package [2] is lacking the values for the mouse buttons. [1] https://docs.unity3d.com/2018.1/Documentation/ScriptReference/EventSystems.PointerEventData-pointerId.html [2] https://docs.unity3d.com/Packages/com.unity.ugui@3.0/api/UnityEngine.EventSystems.PointerEventData.html
Restore the original pointerId, since the eventData is reused, to keep it correct at all times.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Fixes the following bug: https://unity3d.atlassian.net/servicedesk/customer/portal/2/IN-90349
When using the IPointerDownHandler (OnPointerDown method) with the New Input System, the eventData.pointerId for any mouse button is always the same, corresponding to the mouse's deviceId.
According to the documentation for Unity 2018:
I mention the 2018 because the documentation on the standalone Unity UI package is lacking the values for the mouse buttons.
Testing status & QA
Tested locally.
Overall Product Risks
Comments to reviewers
Note that
m_CurrentPointerIdis set and checked against the value-1, which is the same value that should be used for the left mouse button, but in the case of them_CurrentPointerIdit means "none". This is not a problem in the current fix, as it only changes theeventDataobject being passed to the event listeners, so them_CurrentPointerIdwill still contain the originalpointerId, which would be the mouse'sdeviceId.Checklist
Before review:
Changed,Fixed,Addedsections.Area_CanDoX,Area_CanDoX_EvenIfYIsTheCase,Area_WhenIDoX_AndYHappens_ThisIsTheResult.During merge:
NEW: ___.FIX: ___.DOCS: ___.CHANGE: ___.RELEASE: 1.1.0-preview.3.After merge: