Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


EventBase

The base class for all UIElements events. The class implements IDisposable to ensure proper release of the event from the pool and of any unmanaged resources, when necessary.
Read time 2 minutesLast updated 8 days ago

Definition

public abstract class EventBase : IDisposable

Constructors

Constructor

Description

EventBase()Constructor. Avoid creating new event instances. Instead, use GetPooled() to get an instance from a pool of reusable event instances.

Properties

Property

Description

bubblesReturns whether this event type bubbles up in the event propagation path during the BubbleUp phase.
currentTargetThe current target of the event. This is the VisualElement, in the propagation path, for which event handlers are currently being executed.
dispatchIndicates whether the event is being dispatched to a visual element. An event cannot be redispatched while it being dispatched. If you need to recursively dispatch an event, it is recommended that you use a copy of the event.
eventTypeIdRetrieves the type ID for this event instance.
ignoreDisabledElementsIf this property is true, callbacks for this event are not invoked when the current target is disabled, unless those callbacks are registered using the CallbackOptions.IncludeDisabled option.
imguiEventThe IMGUIEvent at the source of this event. The source can be null since not all events are generated by IMGUI.
isImmediatePropagationStoppedIndicates whether EventBase.StopImmediatePropagation() was called for this event.
isPropagationStoppedReturns true if EventBase.StopPropagation() or EventBase.StopImmediatePropagation() was called for this event.
originalMousePositionThe original mouse position of the IMGUI event, before it is transformed to the current target local coordinates.
pooledWhether the event is allocated from a pool of events.
propagationPhaseThe current propagation phase for this event.
targetThe target visual element that received this event. Unlike currentTarget, this target does not change when the event is sent to other elements along the propagation path.
timestampThe time when the event was dispatched, in milliseconds.
tricklesDownReturns whether this event is sent down the event propagation path during the TrickleDown phase.

Methods

Method

Description

DisposeImplementation of IDisposable.
InitResets all event members to their initial values.
PostDispatchAllows subclasses to perform custom logic after the event has been dispatched.
PreDispatchAllows subclasses to perform custom logic before the event is dispatched.
StopImmediatePropagationStops the propagation of the event to other targets, and prevents other subscribers to the event on this target to receive the event.
StopPropagationStops the propagation of the event to other targets. All subscribers to the event on this target still receive the event.

Static Methods

Method

Description

RegisterEventTypeRegisters an event class to the event type system.