So I am using the EventSystem with a PhysicsRaycaster in the camera to get events such as clicks,drags, and other stuff in objects that have colliders.
Problem is that I also need to catch any event action in the screen when the user scrolls and drags to pan around and zoom with camera but I’m trying to add a UI panel to get those events but then it blocks any events that would hit the other objects with colliders since they are “under” the UI panel.
I’ve tried to set the physics raycaster to ignore the UI layer but it doesn’t work. I’ve also tried to have instead of the UI panel a big collider in the back of the camera and objects but then you don’t receive the events when you click over a collider.
I too (at first) started to use the event system to handle the gestures and implementing the handlers, but found as more layers and controls were needed it became a bit of a PITA to deal with… so I started using TouchScript and it is helping a lot.
Looks interesting!
But I would like it to be integrated with the Unity UI and they use the same Event system so I’m not sure how much it would help. Thanks for the suggestion, I’ll keep that one in mind for other types of projects
As an alternative solution you could use EventSystem.RaycastAll to get all of the elements at a certian point, then pass on the appropriate events with ExecuteEvents.
The other option is to break open the EventSystem code and write your own version that uses RaycastAll.
and it may be possible to just implement ICanvasRaycastFilter set to false (from IsRaycastLocationValid) to not consume the cast… but still be able to handle events (atleast that’s what I gathered from what superpig mentioned)
??
[edit]
also looks like you may be able to add a ‘canvas group’ to the element and set ‘blocks raycasts’ (either statically or programmatically)
Just tried both options and they both either ignore it completely (so no event calls) or block like usual. I have seen that variable in the PointerEventData that is named ‘used’. I’ll look into that and see what it does.
Never got a “Perfect” solution for this, it was either modify the git repository which I think it’s way too much work for something like that or like mentioned above use other libraries that connect with it. For my situation I just decided to use the regular Input class and do some platform compilation dependencies, I’m sure there is something that can be done but I decided for a simple solution for now.