-
Notifications
You must be signed in to change notification settings - Fork 325
NEW: MouseEvents for InputSystem Samples & Tests #2207
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?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅ @@ Coverage Diff @@
## develop #2207 +/- ##
===========================================
+ Coverage 68.11% 68.16% +0.04%
===========================================
Files 367 367
Lines 53610 53610
===========================================
+ Hits 36519 36544 +25
+ Misses 17091 17066 -25
Flags with carried forward coverage won't be shown. Click here to find out more. see 8 files with indirect coverage changes 🚀 New features to boost your workflow:
|
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.
Nice work @ritamerkl ! I like the approach and the sample is of reasonable size to test the main functionality. Also really nice to have plenty of tests.
However:
- This functionality needs to be guarded with defines in asmdef, as this will only be available from 6.3 forward AFAIK. So if I try this PR without the trunk PR, I'll get compilation errors.
- I would like to see at least 1 test with Touch as well, particularly with more than 1 touch. Mouse and Pen are pretty similar as they are a single pointer.
var mouse = InputSystem.AddDevice<Mouse>(); | ||
|
||
var gameObject = GameObject.CreatePrimitive(PrimitiveType.Cube); | ||
gameObject.AddComponent<OnMouseEventsTest>(); | ||
gameObject.transform.position = Vector3.zero; | ||
var camera = new GameObject("MainCamera").AddComponent<Camera>(); | ||
camera.transform.position = new Vector3(0, 0, -2f); | ||
camera.tag = "MainCamera"; | ||
var vec = Camera.main.WorldToScreenPoint(gameObject.transform.position); | ||
SetMouse(mouse, new Vector2(vec.x, vec.y), 1f); |
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 find this boilerplate code being repeated amongst tests. Could we create a function for it or combine the tests together?
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.
Good idea, I did that here: b0201e1
Also there's some CI failures that will need to be addressed. Not sure if it's only because of the lack of defines or if there's any impact on pointer devices functionality. |
WIP: working on adding touch samples (multi-touch) & parallel pointers (eg. touch&pen). |
Description
This PR adds tests and samples for the OnMouse events working with the InputSystem. The OnMouse behaviour for the InputSystem is introduced with this PR and this PR should land together (shortly after) it.
Testing status & QA
Only manual testing for the sample.
Overall Product Risks
Comments to reviewers
Please review together with https://github.cds.internal.unity3d.com/unity/unity/pull/73198.
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
.After merge: