#Raycasting from UI to WorldSpace?

1 messages · Page 1 of 1 (latest)

distant tinsel
#

Hello, I'm trying to code a Drag and Drop system of a GameObject. The thing is that for this GameObject I have an Icon assigned to it, and I want to show it when the user is dragging over an UI element then, after the user isn't over the UI anymore, Raycast over the worldspace, switching from the Icon to the GameObject.

As far as I know, Raycasting doesn't work over elements on Canvas, so, is there any way to do something like this?

Thanks.

amber frigate
#

Or physics raycast and figure out the screen space position, but probably easier just to use a canvas raycast too

distant tinsel
#

Got it that way, thank you so much!