Offset between mouse cursor position and "hit" position with worldspace UI's

Hello,

I am noticing a problem with my worldspace gui’s.

It seems that my UI elements (I have tested this with buttons and text input field) do not have the correct collision bounds in world space. The actual hitbox of the graphic raycast is offset from the button or ui element.

This image should show what I am talking about:

alt text

The red debug line shows the direction of the users view (and location of the mouse pointer on the screen). The yellow button with “ECM” written on it is being triggered (yellow is its active state) but the red line is not actually in contact with the button.

This problem occurs with all of my gui’s, in both the editor and the build.

I can’t seem to track down a solution to this. I replaced the built-in graphicraycast script with one that I found on github, but the issue was the same.

With larger gui buttons, the offset is less noticeable, but I need to make some fairly complex gui’s with lots of buttons, which means I need to solve this issue. Does anyone have any ideas?

I am using Unity 5.6.

I have a problem similar to yours. If you find a solution, please tell me…