- Home /
Screen space UI rays inaccurate
I'm using a screen space overlay canvas with various buttons and toggles, with the render camera set to the only camera in the scene which is in perspective mode. The scene is 3D. I have a movement script on the camera which allows it's y position to be anywhere between 10 and 12000.
I'm experiencing an odd issue with the UI elements when the camera's y position gets too high. At around 2500 the UI is inaccurate (e.g. I have to click some way to the left of a button to activate it). At heights over 5000 the UI is completely unresponsive (or possibly too inaccurate to get a hit?).
I've played around with all the settings in the canvas scaler script and graphic raycaster scripts to no effect. Altering the plane distance in the canvas makes no difference. The UI works fine in screen space overlay mode.
Thanks.
Answer by Absinthe23 · Feb 14, 2018 at 06:05 PM
I figured out the problem eventually. If anyone else has this problem try increasing the near clipping plane on the camera.
Thank you!
This solved a problem I had with the cursor of the HoloToolkit beeing some distance away from the UI (even after changing Surface Cursor Distance to 0). Just changed the Near Clipping Plane to 0 of the UiRaycastCamera and now the Cursor is positioned correctly.
Great! Just check your build / game view once in a while as sometimes you can get a bit of scenery clipping at low values, you might need to increase by 0.05 or so at a time until you find a value that solves both issues.
Your answer
Follow this Question
Related Questions
Question about raycasting and UI button 0 Answers
Raycasting on UI graphic with custom shape 0 Answers
Can't see EmptyObject in scene viewer,Can't See Empty Object in Scene View 3 Answers
IDragHandler goes through buttons 0 Answers
Is it possible to raycast multiple objects of the same tag (Enemy) 1 Answer