Raycast hitinfo on unity ui?


I’ve recently thought up it would be cool to have a way to write notes while in the game I’m making. To do this i tried moving around trail render prefabs based on where a plane (not a gameobject plane but an the endless kind).

And that worked all well until i realized you cannot rotate such a plane (aswell as i want to limit the note writing to only a part of the screen), so i tried out using a mesh but since i can’t figure out a way to anchor it to the ui it woulden’t work very well with different screensizes.

Therefore the best thing i can come up with would be to raycast the ui itself, if possible that is. I tried searching around and found out theres this thing called GraphicRaycaster, but I’m not sure it would work for the purpose i intend it too, nor how to use it.

If anyone knows how to do this or an alternative method for getting positions so i can move around the trail renderers i would appreciate it alot.

Nevermind, found out that raycast2d is a thing. Just had to stick a 2d collider to the ui element and everythings now working like intended ^^