Version: 2017.3 (switch to 2017.4)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Event

class in UnityEngine

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

A UnityGUI event.

Events correspond to user input (key presses, mouse actions), or are UnityGUI layout or rendering events.

For each event OnGUI is called in the scripts; so OnGUI is potentially called multiple times per frame. Event.current corresponds to "current" event inside OnGUI call.

See Also: GUI Scripting Guide, EventType.

Static Properties

currentThe current event that's being processed right now.

Properties

altIs Alt/Option key held down? (Read Only)
buttonWhich mouse button was pressed.
capsLockIs Caps Lock on? (Read Only)
characterThe character typed.
clickCountHow many consecutive mouse clicks have we received.
commandIs Command/Windows key held down? (Read Only)
commandNameThe name of an ExecuteCommand or ValidateCommand Event.
controlIs Control key held down? (Read Only)
deltaThe relative movement of the mouse compared to last event.
displayIndexIndex of display that the event belongs to.
functionKeyIs the current keypress a function key? (Read Only)
isKeyIs this event a keyboard event? (Read Only)
isMouseIs this event a mouse event? (Read Only)
keyCodeThe raw key code for keyboard events.
modifiersWhich modifier keys are held down.
mousePositionThe mouse position.
numericIs the current keypress on the numeric keyboard? (Read Only)
shiftIs Shift held down? (Read Only)
typeThe type of event.

Public Methods

GetTypeForControlGet a filtered event type for a given control ID.
UseUse this event.

Static Methods

GetEventCountReturns the current number of events that are stored in the event queue.
KeyboardEventCreate a keyboard event.
PopEventGet the next queued [Event] from the event system.

Did you find this page useful? Please give it a rating: