I’m writing a selection manager for a 2D sprite based game and want the new UI to block raycasts. Idea is to Raycast against UI and there is a method for that, but how do I use it. Where do I get eventData to feed into it?
public void Raycast(PointerEventData eventData, List<RaycastResult> resultAppendList);
EDIT:
A workaround I’m using right now is having 2D trigger colliders attached to stuff under Canvas. Then I use Physics2D.OverlapPointAll(Camera.main.ScreenToWorldPoint(Input.mousePosition)) and block click processing in selection manager if that hit some collider under Canvas.
Hi, not sure if this will help in your case, I don’t know what doesn’t work for your with GraphicRaycaster - But it’s a component, you get it, then use it - and here’s an example how to use it: