Pointers
Pointer
devices are defined as InputDevices
that track positions on a 2D surface. Three types of pointers are supported:
Controls
Each of these types implements a common set of controls. For a more detailed descriptions of these controls, refer to their scripting reference.
Control | Type | Description |
---|---|---|
position |
Vector2Control |
The current pointer coordinates in window space. |
delta |
Vector2Control |
The difference in position since the last frame. |
press |
ButtonControl |
Whether the pointer or it's primary button is pressed down. |
pressure |
AxisControl |
Normalized pressure with which the pointer is currently pressed while in contact with the pointer surface (Only relevant for pressure sensitive devices, such as tablets and some touch screens). |
radius |
Vector2Control |
The size of the area where the finger touches the surface. Only relevant for touch input. |
Window Space
Within player code, the coordinates are in the coordinate space of the player window.
Within editor code, the coordinates are in the coordinate space of the current EditorWindow
. This means that if you query Pointer.current.position
in UnityEditor.EditorWindow.OnGUI
, for example, the returned 2D vector will be in the coordinate space of your local GUI (same as UnityEngine.Event.mousePosition
).