Cursors Render behind UnityUI on Unity 2017
See original GitHub issueThe problem is that the cursor now renders behind the UnityUI at about the same distance as the “near clipping plane” in the Main Camera. I’ve set the canvas to Z depth 2. And my “near clipping plane” is 0.85
I’ve been comparing the results between unity 5.6 and 2017. Nothing much seems to have changed in the GazeManager.cs but in “RaycastUnityUI”
EventSystem.current.RaycastAll(UnityUIPointerEvent, raycastResultList);
Seems to account for the near clipping distance too in unity 2017 and always returns 2.9 as the distance for the objects in “raycastResultList”. It does not in unity 5.6. In GazeManager.cs - RaycastUnityUI there is code to manually account for this
float uiRaycastDistance = uiRaycastResult.distance + Camera.main.nearClipPlane;
So in 2017 it accounts for the nearClipPlane twice and renders all cursors behind the UI elements. I’m guessing that you do not need the “+ Camera.main.nearClipPlane” anymore.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top GitHub Comments
Found this in the 2017.1 release notes:
Unity now correctly calculates the raycast from the near clip plane.
Haha, yeah, pretty much