question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cursors Render behind UnityUI on Unity 2017

See original GitHub issue

The 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

image

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:closed
  • Created 6 years ago
  • Reactions:2
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
StephenHodgsoncommented, Jul 26, 2017

Found this in the 2017.1 release notes:

  • UI: Fixed GraphicRaycaster Ray-cast distance value (848130)

Unity now correctly calculates the raycast from the near clip plane.

0reactions
StephenHodgsoncommented, Jul 28, 2017

Haha, yeah, pretty much

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unity UI - Render Custom Mouse cursor on top of canvas
I just created a custom mouse pointer: public class MousePointer : MonoBehaviour { void Start () { Cursor.visible = false; }...
Read more >
Render cursor behind UnityUI
I'm looking to render the AC cursor behind a Unity UI based AC menu. ... The UI cursor is lagging slightly behind the...
Read more >
unity - Dragging UI element lags behind the cursor
1 Answer. Your computer is using a hardware cursor, which is extremely fast at rendering the cursor.
Read more >
Position UI to mouse position (Make Tooltip panel follow ...
Unity is currently redesigning the InputSystem to fix this problem. The current workaround is to disable the cursor with Cursor.visible ...
Read more >
Reactive Custom Cursors [Unity Tutorial] - YouTube
... cursor when you're hovering over a clickable object for both Game Objects and UI elements! Join me and learn your way through...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found