docs.unity3d.com
  • Manual
  • Scripting API
  • Changelog
  • License
    Show / Hide Table of Contents
    • Scripting API

    Class EventBase

    The base class for all UIElements events.

    Inheritance
    Object
    EventBase
    EventBase<T>
    Namespace: UnityEngine.UIElements
    Syntax
    public abstract class EventBase : IDisposable

    Constructors

    EventBase()

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

    Declaration
    protected EventBase()

    Properties

    bubbles

    Returns whether this event type bubbles up in the event propagation path.

    Declaration
    public bool bubbles { get; protected set; }
    Property Value
    Type Description
    Boolean

    currentTarget

    The current target of the event. This is the VisualElement, in the propagation path, for which event handlers are currently being executed.

    Declaration
    public virtual IEventHandler currentTarget { get; }
    Property Value
    Type Description
    IEventHandler

    dispatch

    Indicates 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.

    Declaration
    public bool dispatch { get; }
    Property Value
    Type Description
    Boolean

    eventTypeId

    Retrieves the type ID for this event instance.

    Declaration
    public virtual long eventTypeId { get; }
    Property Value
    Type Description
    Int64

    imguiEvent

    The IMGUIEvent at the source of this event. The source can be null since not all events are generated by IMGUI.

    Declaration
    public Event imguiEvent { get; protected set; }
    Property Value
    Type Description
    Event

    isDefaultPrevented

    Returns true if the default actions should not be executed for this event.

    Declaration
    public bool isDefaultPrevented { get; }
    Property Value
    Type Description
    Boolean

    isImmediatePropagationStopped

    Indicates whether StopImmediatePropagation() was called for this event.

    Declaration
    public bool isImmediatePropagationStopped { get; }
    Property Value
    Type Description
    Boolean

    isPropagationStopped

    Whether StopPropagation() was called for this event.

    Declaration
    public bool isPropagationStopped { get; }
    Property Value
    Type Description
    Boolean

    originalMousePosition

    The original mouse position of the IMGUI event, before it is transformed to the current target local coordinates.

    Declaration
    public Vector2 originalMousePosition { get; }
    Property Value
    Type Description
    Vector2

    pooled

    Whether the event is allocated from a pool of events.

    Declaration
    protected bool pooled { get; set; }
    Property Value
    Type Description
    Boolean

    propagationPhase

    The current propagation phase.

    Declaration
    public PropagationPhase propagationPhase { get; }
    Property Value
    Type Description
    PropagationPhase

    target

    The 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.

    Declaration
    public IEventHandler target { get; set; }
    Property Value
    Type Description
    IEventHandler

    timestamp

    The time when the event was created.

    Declaration
    public long timestamp { get; }
    Property Value
    Type Description
    Int64

    tricklesDown

    Returns whether this event is sent down the event propagation path during the TrickleDown phase.

    Declaration
    public bool tricklesDown { get; protected set; }
    Property Value
    Type Description
    Boolean

    Methods

    Dispose()

    Implementation of IDisposable.

    Declaration
    public abstract void Dispose()

    Init()

    Resets all event members to their initial values.

    Declaration
    protected virtual void Init()

    PostDispatch()

    Declaration
    protected virtual void PostDispatch()

    PostDispatch(IPanel)

    Allows subclasses to perform custom logic after the event has been dispatched.

    Declaration
    protected virtual void PostDispatch(IPanel panel)
    Parameters
    Type Name Description
    IPanel panel

    The panel where the event has been dispatched.

    PreDispatch()

    Declaration
    protected virtual void PreDispatch()

    PreDispatch(IPanel)

    Allows subclasses to perform custom logic before the event is dispatched.

    Declaration
    protected virtual void PreDispatch(IPanel panel)
    Parameters
    Type Name Description
    IPanel panel

    The panel where the event will be dispatched.

    PreventDefault()

    Indicates whether the default actions are prevented from being executed for this event.

    Declaration
    public void PreventDefault()

    RegisterEventType()

    Registers an event class to the event type system.

    Declaration
    protected static long RegisterEventType()
    Returns
    Type Description
    Int64

    The type ID.

    StopImmediatePropagation()

    Immediately stops the propagation of the event. The event isn't sent to other elements along the propagation path. This method prevents other event handlers from executing on the current target.

    Declaration
    public void StopImmediatePropagation()

    StopPropagation()

    Stops propagating this event. The event is not sent to other elements along the propagation path. This method does not prevent other event handlers from executing on the current target.

    Declaration
    public void StopPropagation()
    In This Article
    • Constructors
      • EventBase()
    • Properties
      • bubbles
      • currentTarget
      • dispatch
      • eventTypeId
      • imguiEvent
      • isDefaultPrevented
      • isImmediatePropagationStopped
      • isPropagationStopped
      • originalMousePosition
      • pooled
      • propagationPhase
      • target
      • timestamp
      • tricklesDown
    • Methods
      • Dispose()
      • Init()
      • PostDispatch()
      • PostDispatch(IPanel)
      • PreDispatch()
      • PreDispatch(IPanel)
      • PreventDefault()
      • RegisterEventType()
      • StopImmediatePropagation()
      • StopPropagation()
    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023