概述
IPointerEnterHandler - OnPointerEnter - Called when a pointer enters the object
指针进入
public void OnPointerEnter(PointerEventData eventData);
IPointerExitHandler - OnPointerExit - Called when a pointer exits the object
指针退出
public void OnPointerExit(PointerEventData eventData);
IPointerDownHandler - OnPointerDown - Called when a pointer is pressed on the object
指针按下
public void OnPointerDown(PointerEventData eventData);
IPointerUpHandler - OnPointerUp - Called when a pointer is released (called on the original the pressed object)
指针释放(可能按下时的指针位置跟释放时的指针位置不同,这里指的是按下时指针指着的物体)
public void OnPointerUp(PointerEventData eventData);
IPointerClickHandler - OnPointerClick - Called when a pointer is pressed and released on the same object
在同一物体上按下并释放
public void OnPointerClick(PointerEventData eventData);
IInitializePotentialDragHandler - OnInitializePotentialDrag - Called when a drag target is found, can be used to initialise values
拖拽时的初始化,跟IPointerDownHandler差不多,在按下时调用
public void OnInitializePotentialDrag(PointerEventData eventData);
IBeginDragHandler - OnBeginDrag - Called on the drag object when dragging is about to begin
开始拖拽
public void OnBeginDrag(PointerEventData eventData);
IDragHandler - OnDrag - Called on the drag object when a drag is happening
拖拽中
public void OnDrag(PointerEventData eventData);
IEndDragHandler - OnEndDrag - Called on the drag object when a drag finishes
拖拽结束(被拖拽的物体调用)
public void OnEndDrag(PointerEventData eventData);
IDropHandler - OnDrop - Called on the object where a drag finishes
拖拽结束(拖拽结束后的位置(即鼠标位置)如果有物体,则那个物体调用)
public void OnDrop(PointerEventData eventData);
IScrollHandler - OnScroll - Called when a mouse wheel scrolls
滚轮滚动
public void OnScroll(PointerEventData eventData);
IUpdateSelectedHandler - OnUpdateSelected - Called on the selected object each tick
被选中的物体每帧调用
public void OnUpdateSelected(BaseEventData eventData);
ISelectHandler - OnSelect - Called when the object becomes the selected object
物体被选中时(EventSystem.current.SetSelectedGameObject(gameObject))
public void OnSelect(BaseEventData eventData);
IDeselectHandler - OnDeselect - Called on the selected object becomes deselected
物体从选中到取消选中时
public void OnDeselect(BaseEventData eventData);
IMoveHandler - OnMove - Called when a move event occurs (left, right, up, down, ect)
物体移动时(与InputManager里的Horizontal和Vertica按键相对应),前提条件是物体被选中
public void OnMove(AxisEventData eventData);
ISubmitHandler - OnSubmit - Called when the submit button is pressed
提交按钮被按下时(与InputManager里的Submit按键相对应,PC上默认的是Enter键),前提条件是物体被选中
public void OnSubmit(BaseEventData eventData);
ICancelHandler - OnCancel - Called when the cancel button is pressed
取消按钮被按下时(与InputManager里的Cancel按键相对应,PC上默认的是Esc键),前提条件是物体被选中
public void OnCancel(BaseEventData eventData);
作者:宏哥1995
来源:CSDN
原文:https://blog.csdn.net/lyh916/article/details/44570503
最后
以上就是斯文书包为你收集整理的unity事件API的全部内容,希望文章能够帮你解决unity事件API所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复