I have written my own component, which implements IBeginDragHandler, IDragHandler and IDropHandler. I want to add an EventTrigger component that comes with UnityEngine.UI, but when I add it I stop getting calls to OnDrop on my component. OnBeginDrag and OnDrag are called as usual.
My component code:
public class MyComponent : MonoBehaviour, IBeginDragHandler, IDragHandler, IDropHandler
{
public void OnBeginDrag(PointerEventData eventData)
{
Debug.Log("OnBeginDrag!");
}
public void OnDrag(PointerEventData eventData)
{
Debug.Log("OnDrag!");
}
public void OnDrop(PointerEventData eventData)
{
Debug.Log("OnDrop!");
}
}
When I start my scene with a Game object with this component attached, the expected log output is:
OnBeginDrag!
OnDrag!
...
OnDrag!
OnDrop!
This is the case as long as I only have default components and my component. But if I add an Event → Event Trigger component (without even specifying anything in it) to the same GameObject and run again, the output is:
OnBeginDrag!
OnDrag!
...
OnDrag!
The OnDrop is never called. The order of the components doesn’t affect anything.
Is there a way to stop EventTrigger from using up the OnDrop call?