Game Development Reference
In-Depth Information
At the core of Unity's new input event system, there are several interfaces that
describe all the different types of events the base implementation is able to handle:
I say base events because the system is fully extendable and you can
create your own events should you wish.
•
PointerEnter
(
IPointerEnterHandler/OnPointerEnter
): This is similar to
the
onTriggerEnte
r or
OnCollisionEnter
interfaces. It denotes the point
when a cursor enters the region within a
Unity UI
control.
•
PointerExit
(IPointerExitHandler/OnPointerExit
): Like
onTriggerExit
or
OnCollisionExit
. It denotes the point when a cursor leaves the region of
a
Unity UI
control.
•
PointerDown
(
IPointerDownHandler/OnPointerDown
): This is fired
when a
Mouse
button or
Touch
is held down; it fires for each frame where
the button/touch is held.
•
PointerUp
(
IPointerUpHandler/OnPointerUp
): This is fired when a Mouse
or Touch is released from being held (Not on release of click).
•
PointerClick
(
IPointerClickHandler/OnPointerClick
): This is fired when
the user releases the mouse click or a touch on the same GameObject it was
pressed on. (If the user hasn't moved the pointer off the GameObject.)
•
Drag
(
IDragHandler/OnDrag
): This is fired when a draggable object is held
and movement has started in any direction (Movement delta increased).
•
Drop
(
IDropHandler/OnDrop
): This is fired when a draggable item has been
moved and the mouse or touch has been released, finishing the movement.
•
Scroll
(IScrollHandler/OnScroll
): Fired when a scroll wheel on a mouse
or controller is used.
•
UpdateSelected
(
IUpdateSelectedHandler/OnUpdateSelected
): This is
fired whenever the contents of a control are updated, such as a text field.
•
Select
(
ISelectHandler/OnSelect
): This is fired when an object or toggle is
selected and focus is achieved, for example, when navigation occurs between
Interactable GameObjects/Controls.
•
Deselect
(
IDeselectHandler/OnDeselect
): This is fired when an object or
toggle is deselected and focus is lost. For example,when navigation occurs
between Interactable GameObjects/Controls.
•
Move
(IMoveHandler/OnMove
): This is a continuous event that is fired while
a draggable object is being moved (Constant delta increase).