Make EventSystem ignore a collider

I have a scene where there are two objects: One invisible object with a box collider, and one cube with a box collider, that has a component that implements IDragHandler, that is placed inside the first collider.

When the cube is placed outside the first collider, dragging works, but when the cube is placed inside the first collider, the first collider eats up the event from EventSystem. Is there a way to ignore the first collider and/or forward the drag event to the object inside the first collider?

Placing the first object in the IgnoreRaycasts layer had no effect.

@helenaudd you need to set the Event Mask of the Physics Raycaster. I’m surre you attach it to the Camera. There, you set the Layers where you want the IDragHandler to take effect.


In my case, I created a layer named “Dragable” and set it in all my dragable 3D objects (that have a collider). Then I set it to be the only layer active in the Event Mask of the Physics Raycaster.


Here’s the configuration:
204565-dragable-1.png
204566-dragable-2.png


public class xzPlaneDrag : MonoBehaviour, IDragHandler, IBeginDragHandler, IEndDragHandler, IPointerClickHandler