# EventType

> Types of UnityGUI input and processing events.

## Definition

* **Type:** Enum
* **Namespace:** [UnityEngine](/engine/6000.6/script-reference/unityengine.md)
* **Assembly:** UnityEngine.IMGUIModule

```csharp
public enum EventType
```

## Remarks

Use this to tell which type of event has taken place in the GUI. Types of Events include mouse clicking, mouse dragging, button pressing, the mouse entering or exiting the window, and the scroll wheel as well as others mentioned below.

Events can be used to prevent other GUI elements from responding to that event. Refer to [Event.Use](/engine/6000.6/script-reference/unityengine/event/use.md).

Additional Resources: [Event.type](/engine/6000.6/script-reference/unityengine/event/type.md), [Event](/engine/6000.6/script-reference/unityengine/event.md), [GUI Scripting Guide](/engine/6000.6/manual/uitoolkits/ui-imgui/guiscripting-guide.md).

## Examples

```csharp
//Attach this script to a GameObject
//This script is a basic overview of some of the Event Types available. It outputs messages depending on the current Event Type.

using UnityEngine;

public class Example : MonoBehaviour
{
    void OnGUI()
    {
        Event m_Event = Event.current;

        if (m_Event.type == EventType.MouseDown)
        {
            Debug.Log("Mouse Down.");
        }

        if (m_Event.type == EventType.MouseDrag)
        {
            Debug.Log("Mouse Dragged.");
        }

        if (m_Event.type == EventType.MouseUp)
        {
            Debug.Log("Mouse Up.");
        }
    }
}
```

```csharp
using UnityEngine;

public class Example : MonoBehaviour
{
    void OnGUI()
    {
        Event m_Event = Event.current;

        if (m_Event.type == EventType.MouseDown)
        {
            if (m_Event.pointerType == PointerType.Pen)     //Check if it's a pen event.
                Debug.Log("Pen Down.");
            else 
                Debug.Log("Mouse Down.");                   //If it's not a pen event, it's a mouse event. 
        }
    }
}
```

## Fields

| Value                                                                                         | Description                                                                      |
| --------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| [ContextClick](/engine/6000.6/script-reference/unityengine/eventtype/contextclick.md)         | User has right-clicked (or control-clicked on the mac).                          |
| [DragExited](/engine/6000.6/script-reference/unityengine/eventtype/dragexited.md)             | Editor only: drag & drop operation exited.                                       |
| [DragPerform](/engine/6000.6/script-reference/unityengine/eventtype/dragperform.md)           | Editor only: drag & drop operation performed.                                    |
| [DragUpdated](/engine/6000.6/script-reference/unityengine/eventtype/dragupdated.md)           | Editor only: drag & drop operation updated.                                      |
| [ExecuteCommand](/engine/6000.6/script-reference/unityengine/eventtype/executecommand.md)     | Execute a special command (eg. copy & paste).                                    |
| [Ignore](/engine/6000.6/script-reference/unityengine/eventtype/ignore.md)                     | [Event](/engine/6000.6/script-reference/unityengine/event.md) should be ignored. |
| [KeyDown](/engine/6000.6/script-reference/unityengine/eventtype/keydown.md)                   | A keyboard key was pressed.                                                      |
| [KeyUp](/engine/6000.6/script-reference/unityengine/eventtype/keyup.md)                       | A keyboard key was released.                                                     |
| [Layout](/engine/6000.6/script-reference/unityengine/eventtype/layout.md)                     | A layout event.                                                                  |
| [MouseDown](/engine/6000.6/script-reference/unityengine/eventtype/mousedown.md)               | Mouse button was pressed.                                                        |
| [MouseDrag](/engine/6000.6/script-reference/unityengine/eventtype/mousedrag.md)               | Mouse was dragged.                                                               |
| [MouseEnterWindow](/engine/6000.6/script-reference/unityengine/eventtype/mouseenterwindow.md) | Mouse entered a window (Editor views only).                                      |
| [MouseLeaveWindow](/engine/6000.6/script-reference/unityengine/eventtype/mouseleavewindow.md) | Mouse left a window (Editor views only).                                         |
| [MouseMove](/engine/6000.6/script-reference/unityengine/eventtype/mousemove.md)               | Mouse was moved (Editor views only).                                             |
| [MouseUp](/engine/6000.6/script-reference/unityengine/eventtype/mouseup.md)                   | Mouse button was released.                                                       |
| [Repaint](/engine/6000.6/script-reference/unityengine/eventtype/repaint.md)                   | A repaint event. One is sent every frame.                                        |
| [ScrollWheel](/engine/6000.6/script-reference/unityengine/eventtype/scrollwheel.md)           | The scroll wheel was moved.                                                      |
| [TouchDown](/engine/6000.6/script-reference/unityengine/eventtype/touchdown.md)               | Direct manipulation device (finger, pen) touched the screen.                     |
| [TouchEnter](/engine/6000.6/script-reference/unityengine/eventtype/touchenter.md)             | Direct manipulation device (finger, pen) moving into the window (drag).          |
| [TouchLeave](/engine/6000.6/script-reference/unityengine/eventtype/touchleave.md)             | Direct manipulation device (finger, pen) moved out of the window (drag).         |
| [TouchMove](/engine/6000.6/script-reference/unityengine/eventtype/touchmove.md)               | Direct manipulation device (finger, pen) moved on the screen (drag).             |
| [TouchStationary](/engine/6000.6/script-reference/unityengine/eventtype/touchstationary.md)   | Direct manipulation device (finger, pen) stationary event (long touch down).     |
| [TouchUp](/engine/6000.6/script-reference/unityengine/eventtype/touchup.md)                   | Direct manipulation device (finger, pen) left the screen.                        |
| [Used](/engine/6000.6/script-reference/unityengine/eventtype/used.md)                         | Already processed event.                                                         |
| [ValidateCommand](/engine/6000.6/script-reference/unityengine/eventtype/validatecommand.md)   | Validates a special command (e.g. copy & paste).                                 |
