其他分享
首页 > 其他分享> > unity学习笔记 9个交互响应事件(点击、拖拽等)

unity学习笔记 9个交互响应事件(点击、拖拽等)

作者:互联网

public class ButtonFuc : MonoBehaviour,
IPointerEnterHandler,IPointerExitHandler,//进入,离开
IPointerDownHandler,IPointerUpHandler,//按下,抬起
IPointerClickHandler,//点击并放开
IBeginDragHandler,IDragHandler,IEndDragHandler//开始拖拽,拖拽,结束拖拽
{
    public void OnPointerEnter (PointerEventData eventData)
    {
        Debug.Log ("Enter");
    }

    public void OnPointerExit(PointerEventData eventData)
    {
        Debug.Log ("Exit");
    }

    public void OnPointerDown (PointerEventData eventData)
    {
        Debug.Log ("Down");
    }

    public void OnPointerUp (PointerEventData eventData)
    {
        Debug.Log ("Up");
    }

    public void OnPointerClick (PointerEventData eventData)
    {
        Debug.Log ("Click");
    }

    public void OnBeginDrag (PointerEventData eventData)
    {
        Debug.Log ("BeginDrag");
    }

    public void OnDrag (PointerEventData eventData)
    {
        Debug.Log ("Drag");
    }

    public void OnEndDrag (PointerEventData eventData)
    {
        Debug.Log ("EndDrag");
    }
}

标签:Log,void,public,PointerEventData,unity,Debug,eventData,交互,拖拽
来源: https://blog.csdn.net/weixin_45582142/article/details/114415910