I am having problems getting the new UI system to block raycasts on mobile devices.
EventSystem.current.IsPointerOverGameObject()
This works 100% perfectly on desktop but does not work on touch screen devices.
I’ve tried adding a cube behind my UI elements to block raycasts, Canvas Groups with the blocks raycast option checked and while it all seems to work great on desktop I cannot get it to work the same way on mobile touch screen devices.
I should add I am using Navmesh and Navmesh agent to move my player object to the clicked location on the screen.
I imagine you have found a solution. I had the same problem and what saved it for me is the following:
The EventSystem.current.IsPointerOverGameObject() function takes an ID for which pointer should be tested. 1 is the first finger, 2 is the second finger, etc.
By default, if you don’t specify any argument, it uses the mouse left click ID (-1), and doesn’t work on mobile devices