Documentation

Unity Engine


User Manual

Script Reference

Unity Engine


MouseEventBase<T>

The base class for mouse events.
Read time 3 minutesLast updated 2 days ago

Definition

public abstract class MouseEventBase<T> : EventBase<T>, IDisposable, IMouseEvent where T : MouseEventBase<T>, new()

Remarks

Refer to the Mouse events manual page for more information and examples.

Properties

Property

Description

actionKeyReturns true if the platform-specific action key is pressed.
altKeyReturns true if the Alt key is pressed.
buttonA value that indicates which mouse button was pressed or released (if any) to cause this event: 0 is the left button, 1 is the right button, 2 is the middle button. A negative value indicates that no mouse button changed state during this event.
clickCountThe number of times a button is pressed consecutively.
commandKeyReturns true if the Windows/Cmd key is pressed.
ctrlKeyReturns true if the Ctrl key is pressed.
currentTargetThe current target of the event. The current target is the element in the propagation path for which event handlers are currently being executed.
localMousePositionThe mouse position in the current target coordinate system.
modifiersFlags that hold pressed modifier keys (Alt, Ctrl, Shift, Windows/Cmd).
mouseDeltaGets the difference between the mouse's position during the previous mouse event and its position during the current mouse event.
mousePositionThe mouse position in the panel coordinate system.
pressedButtonsA bitmask that describes the currently pressed buttons.
shiftKeyReturns true if the Shift key is pressed.

Methods

Method

Description

InitResets the event members to their initial values.

Static Methods

Method

Description

GetPooledGets an event from the event pool and initializes it with the given values. Use this function instead of creating new events. Events obtained using this method need to be released back to the pool. You can use
Dispose()
to release them.

Inheritance