- Home /
Question by
fbubble · Jun 14, 2019 at 10:31 AM ·
scrollviewdrag-and-drop
IDropHandler.OnDrop is not triggered on Scroll View's Content part
I have a Scroll View I'd like to drag cards to and from. The Content element of the Scroll View has a simple MonoBehaviour that implements IDropHandler like so
public class DropZone : MonoBehaviour, IDropHandler
{
public void OnDrop(PointerEventData eventData)
{
var draggable = eventData.pointerDrag.GetComponent<Draggable>();
if (draggable == null)
{
return;
}
draggable.SnapTo = transform;
draggable.SiblingIndex = transform.childCount;
}
}
However, this never seems to get triggered. Interestingly though, if I put a Panel inside the Content element and make that a DropZone OnDrop gets called. Is there a reason this might happen and is there some workaround to this problem?
Comment