Version: 2020.3
Language : English
Synthesizing Events
Capture events

Event reference

UI Toolkit sends an event when a user interacts with elements from UI(User Interface) Allows a user to interact with your application. More info
See in Glossary
Toolkit and changes the state of those elements. For example, the following actions all have associated:

  • Resizing a window
  • Selecting a panel
  • Pressing a key on the keyboard

The event design is similar to the Event interface for HTML elements.

Event families

Event types fit into a hierarchy based on the EventBase class. Each event family implements an interface that defines the common characteristics for all events of the same family. For example, BlurEvent and FocusEvent use the FocusEventBase class.

Select any of the event types listed below for more information on the event, its parent class, and links to the API documentation.

Event reference table

The following table is a simple overview of each event type. For more information on an event, see the pages listed above.

Event type Description Trickles down Bubbles up Cancellable
Capture events
MouseCaptureEvent Sent when an element takes the mouse capture. Yes Yes
MouseCaptureOutEvent Sent when an element releases or otherwise loses the mouse capture. Yes Yes
PointerCaptureEvent Sent when an element captures a pointer. Yes Yes
PointerCaptureOutEvent Sent when an element releases a pointer. Yes Yes
Change events
ChangeEvent A generic event sent when the value of an element changes. Yes Yes
Command events
ValidateCommandEvent IMGUI sends this event while it determines whether the command will be handled by an element in the panel. Yes Yes Yes
ExecuteCommandEvent IMGUI sends this event when an element in the panel should execute a command. Yes Yes Yes
Drag events
DragExitedEvent Sent when the drag and drop process ends. Yes Yes
DragUpdatedEvent Sent when the dragged element moves over a drop target. Yes Yes Yes
DragPerformEvent Sent when the dragged element drops onto an acceptable target. Yes Yes Yes
DragEnterEvent The dragged element entered a new VisualElement. This event is sent when the drag operation begins. Yes
DragLeaveEvent The dragged element exited the current drop target. This event is sent when the drag operation ends. Yes
Focus events
FocusOutEvent Sent before an element loses focus. Yes Yes
FocusInEvent Sent before an element gains focus. Yes Yes
BlurEvent Sent after an element has lost focus. Yes
FocusEvent Sent after an element has gained focus. Yes
IMGUI events
IMGUIEvent Sent to encapsulate IMGUI-specific events. Yes Yes Yes
Input events
InputEvent Sent when data is input to a visual element, typically a control.
Keyboard events
KeyDownEvent Sent when the user presses a key on the keyboard. Yes Yes Yes
KeyUpEvent Sent when the user releases a key on the keyboard. Yes Yes Yes
Layout events
GeometryChangedEvent Event sent when either the position or the dimensions of an element changes.
Mouse events
MouseDownEvent Sent when the user presses a mouse button. Yes Yes Yes
MouseUpEvent Sent when the user releases a mouse button. Yes Yes Yes
MouseMoveEvent Sent when the user moves the mouse. Yes Yes Yes
WheelEvent Sent when the user activates the mouse wheel. Yes Yes Yes
MouseEnterWindowEvent Sent when the mouse enters a window. Yes
MouseLeaveWindowEvent Sent when the mouse leaves a window. Yes
MouseEnterEvent Sent when the mouse enters an element or one of its descendants. Yes Yes
MouseLeaveEvent Sent when the mouse leaves an element or one of its descendants. Yes Yes
MouseOverEvent Sent when the mouse enters an element. Yes Yes Yes
MouseOutEvent Sent when the mouse leaves an element. Yes Yes Yes
ContextClickEvent (obsolete) Sent when the user presses and releases the third mouse button. Exists for backwards compatibility with IMGUI. Yes Yes Yes
Pointer events
PointerDownEvent Sent when you press a pointer. Yes Yes Yes
PointerUpEvent Sent when you release a pointer. Yes Yes Yes
PointerMoveEvent Sent when the pointer changes state. Yes Yes Yes
PointerEnterEvent Sent when the pointer enters a visual element, or one of its descendants. Yes Yes
PointerLeaveEvent Sent when the pointer leaves a visual element and all of its descendants. Yes Yes
PointerOverEvent Sent when the pointer enters a visual element. Yes Yes Yes
PointerOutEvent Sent when the pointer leaves a visual element. Yes Yes Yes
PointerStationaryEvent Sent when a pointer type (like a stylus or finger) doesn’t change for a set amount of time determined by the operating system. Yes Yes Yes
PointerCancelEvent Sent when a pointer action is cancelled by the operating system. Yes Yes Yes
Panel events
AttachToPanelEvent Sent right after an element attaches to a panel.
DetachFromPanelEvent Sent just before an element detaches from a panel.
Tooltip events
TooltipEvent Tooltip is sent just before a tooltip is displayed. Yes Yes Yes

  • 2018–11–02 Page amended
Synthesizing Events
Capture events
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961