Ignoring image on screen overlay canvas for raycasting
Hi guys.
I'm currently trying to design mouse control system for RTS. I've just made multiple selection system, and now I have problem with my single selection.
I put invisible image on my screen overlay canvas to detect different Drag Events for multiple selection system. Now every PointerEventData object shows me that I'm raycasting against this image :/
At the moment I see 2 ways of solving the problem: 1) Turn on Raycast target trigger on the canvas image only when BeginDragging is detected by the system. In this way I need to track BeginDragging trigger, which I do not know, how to obtain for the whole game, not only for 1 object.
2) Duplicate raycast when OnPointerDown event occurs and making him to ignore UI canvas layer (or turning it off again). The problem is, that all functions i found in the API return only bool, not the object against which ray had been casted.
Need help on solving this issue:) Maybe, there is another way to fix the problem, and I just didn't get it into account.
I see many people following this question so I will describe how I fixed the problem.
Just decided to give up on managing multiple selection by events and wrote my own dragging detection based on fixedTime passed between clicks.
Also I'm very interested if this problem can be solved by 2 cameras with different raycasters (physical and graphic: one for gameobjects in the scene and second for canvas). But need more investigation into this option.
Your answer
![](https://koobas.hobune.stream/wayback/20220612081541im_/https://answers.unity.com/themes/thub/images/avi.jpg)