Search Issue Tracker

By Design

Votes

0

Found in

2018.2.0a6

Issue ID

1097072

Regression

No

Event.mousePosition returns incorrect value while using HiDPI scaling

Scene/Game View

-

Steps to reproduce:
1. Set Windows scaling to a value higher than 100%
2. Open attached "positionTest.zip" Unity project
3. Open "test" scene
4. In Window->Level Editor window enable the checkbox
5. Click on the "Plane" object in Scene view

Expected results: Event.mousePosition returns correct value and a cube is placed on the position of the click
Actual results: Event.mousePosition returns an unscaled value, cube is placed with an offset from the click position

Reproducible with: 2019.1.0a8, 2018.3.0b8, 2017.2.15f1, 2017.2.0a6
Not reproducible with: 2018.2.0a5 (no HiDPI support before 2017.2.0a6)

  1. Resolution Note:

    Works as designed. MousePosition usage of point units vs the Camera's pixels coordinates is a confusing par of the API. The user script happened to work properly on windows with versions 18.1 and before since EditorGUIUtility.pixelsPerPoints was always 1. Script showed the same issue on 2017.4 on mac with retina displays where EditorGUIUtility.pixelsPerPoints is 2.

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.