Version 3.3.1.2

EventExtensions class

Namespace: Sirenix.Utilities.Editor
Assembly: Sirenix.Utilities.Editor
public static class EventExtensions
Collection of extension methods for UnityEngine.Event.
Inheritance
  • System.Object
  • EventExtensions

Methods

IsHovering(Event, Rect)
Returns true when the user hovers the mouse over the specified rect.
public static bool IsHovering(this Event current, Rect rect)
Parameters
UnityEngine.Event current

The UnityEngine.Event.

UnityEngine.Rect rect

The rect the user can hover.

Returns
System.Boolean

true on any event where the mouse is hovering the specified rect. Otherwise false.

IsMouseOver(Event, Rect)
Returns true when the users mouse is hovering over the specified UnityEngine.Rect
public static bool IsMouseOver(this Event current, Rect rect)
Parameters
UnityEngine.Event current

The UnityEngine.Event.

UnityEngine.Rect rect

The UnityEngine.Rect to check.

Returns
System.Boolean

true if the mouse is over the specified UnityEngine.Rect otherwise false.

OnContextClick(Event, Rect, Boolean)
Returns true when the user right clicks a rect.
public static bool OnContextClick(this Event current, Rect rect, bool useEvent = true)
Parameters
UnityEngine.Event current

The UnityEngine.Event.

UnityEngine.Rect rect

The rect the user can right click.

System.Boolean useEvent

If true then the method will call UnityEngine.Event.Use on the event.

Returns
System.Boolean

true on context click events, on the specified rect. Otherwise false.

OnEventType(Event, EventType)
Returns true on the specified event.
public static bool OnEventType(this Event current, EventType eventType)
Parameters
UnityEngine.Event current

The UnityEngine.Event.

UnityEngine.EventType eventType

The required event type.

Returns
System.Boolean

true on the specified event. Otherwise false.

OnKeyDown(Event, KeyCode, Boolean)
Returns true when the user presses the specified key.
public static bool OnKeyDown(this Event current, KeyCode key, bool useEvent = true)
Parameters
UnityEngine.Event current

The UnityEngine.Event.

UnityEngine.KeyCode key

The key the user has to press.

System.Boolean useEvent

If true then the method will call UnityEngine.Event.Use on the event.

Returns
System.Boolean

true on key down events with the specified key code. Otherwise false.

OnKeyUp(Event, KeyCode, Boolean)
Returns true when the user releases the specified key.
public static bool OnKeyUp(this Event current, KeyCode key, bool useEvent = true)
Parameters
UnityEngine.Event current

The UnityEngine.Event.

UnityEngine.KeyCode key

The key the user has to release.

System.Boolean useEvent

If true then the method will call UnityEngine.Event.Use on the event.

Returns
System.Boolean

true on key up events with the specified key code. Otherwise false.

OnLayout(Event)
Returns true on layout events.
public static bool OnLayout(this Event current)
Parameters
UnityEngine.Event current

The UnityEngine.Event.

Returns
System.Boolean

true on layout events. Otherwise false.

OnLeftClick(Event, Rect, Boolean)
Returns true when the user left clicks a rect.
public static bool OnLeftClick(this Event current, Rect rect, bool useEvent = true)
Parameters
UnityEngine.Event current

The UnityEngine.Event.

UnityEngine.Rect rect

The rect the user can click.

System.Boolean useEvent

If true then the method will call UnityEngine.Event.Use on the event.

Returns
System.Boolean

true on left click events, on the specified rect. Otherwise false.

OnMouseDown(Event, Int32, Boolean)
Returns true when the user presses the specified mouse button.
public static bool OnMouseDown(this Event current, int mouseButton, bool useEvent = true)
Parameters
UnityEngine.Event current

The UnityEngine.Event.

System.Int32 mouseButton

The mouse button the user has to press.

System.Boolean useEvent

If true then the method will call UnityEngine.Event.Use on the event.

Returns
System.Boolean

true on mouse down events with the specified button. Otherwise false.

OnMouseDown(Event, Rect, Int32, Boolean)
Returns true when the user clicks a rect with the mouse.
public static bool OnMouseDown(this Event current, Rect rect, int mouseButton, bool useEvent = true)
Parameters
UnityEngine.Event current

The event.

UnityEngine.Rect rect

The rect the user can click on.

System.Int32 mouseButton

The button the user has to press.

System.Boolean useEvent

If true then the method will call UnityEngine.Event.Use on the event.

Returns
System.Boolean

true on mouse down events with the specified button. Otherwise false.

OnMouseMoveDrag(Event, Boolean)
Returns true whene the user moves or drags the mouse.
public static bool OnMouseMoveDrag(this Event current, bool useEvent = true)
Parameters
UnityEngine.Event current

The UnityEngine.Event.

System.Boolean useEvent

If true then the method will call UnityEngine.Event.Use on the event.

Returns
System.Boolean

true on mouse move or mouse drag events. Otherwise false.

OnMouseUp(Event, Int32, Boolean)
Returns true when the user releases the specified mouse button.
public static bool OnMouseUp(this Event current, int mouseButton, bool useEvent = true)
Parameters
UnityEngine.Event current

The UnityEngine.Event.

System.Int32 mouseButton

The mouse button the user has to release.

System.Boolean useEvent

If true then the method will call UnityEngine.Event.Use on the event.

Returns
System.Boolean

true on mouse up events, with the specified button. Otherwise false.

OnMouseUp(Event, Rect, Int32, Boolean)
Returns true when the user releases the specified mouse button over the specified rect.
public static bool OnMouseUp(this Event current, Rect rect, int mouseButton, bool useEvent = true)
Parameters
UnityEngine.Event current

The UnityEngine.Event.

UnityEngine.Rect rect

The rect the user has to release the mouse button over.

System.Int32 mouseButton

The mouse button the user has to release.

System.Boolean useEvent

If true then the method will call UnityEngine.Event.Use on the event.

Returns
System.Boolean

true on mouse up events, with the specified button and over the specified rect. Otherwise false.

OnRepaint(Event)
Returns true on repaint events.
public static bool OnRepaint(this Event current)
Parameters
UnityEngine.Event current

The UnityEngine.Event.

Returns
System.Boolean

true on repaint events. Otherwise false.