IBeginDragHandler
, IDragHandler
, IDropHandler
を継承するとOnBeginDrag
, OnDrag
, OnDrop
が使えようになるそうです。
public class Example : 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");
}
}
Drag & Dropに限らず、UnityでUIを使うときはEventSystem
も必要になるので気を付けてください。
リンク
uGuiでDrag And Drop処理 – Qiita
https://qiita.com/divideby_zero/items/d8eebc44e151a60b2b81
unity4.6 beta / uGUI ドラッグ編 – petlust
http://petlust.hateblo.jp/entry/2014/08/24/190838