Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

IBeginDragHandler not called without EventTrigger component

Discussion in 'UGUI & TextMesh Pro' started by knowbuddy, Feb 21, 2015.

  1. knowbuddy

    knowbuddy

    Joined:
    Jul 3, 2012
    Posts:
    9
    I have a UIBehaviour that implements the interfaces IBeginDragHandler and IDropHandler. When I drag the object OnBeginDrag is not getting called whereas the OnDrop does. When I attach an EventTrigger component (with no triggers set up in the inspector) to the object it starts working as expected.

    Has the default behaviour changed in one of the last patches? I remember having done that before without attaching an EventTrigger component.
     
  2. eses

    eses

    Joined:
    Feb 26, 2013
    Posts:
    2,637
    I have no idea if it has changed, but I get the same behavior.
     
  3. SimonDarksideJ

    SimonDarksideJ

    Joined:
    Jul 3, 2012
    Posts:
    1,683
    That is odd but I just tested with a script yesterday in 4.6.1 and 4.6.3 with no issue.

    Try using the UIWindowBase control in the Unity UI Extensions bitbucket repo, tested that one again and it works fine (Without EventTrigger)
    https://bitbucket.org/ddreaper/unity-ui-extensions
     
  4. iivo_k

    iivo_k

    Joined:
    Jan 28, 2013
    Posts:
    314
    Seems IBeginDragHandler.OnBeginDrag is not called unless IDragHandler is also implemented.
    Adding an EventTrigger implements all the interfaces, so I guess that why it works.
     
  5. pointcache

    pointcache

    Joined:
    Sep 22, 2012
    Posts:
    576
    Interface segregation principle.