Class Pointer
Base class for pointer-style devices moving on a 2D screen.
Inherited Members
Namespace: UnityEngine.InputSystem
Syntax
public class Pointer : InputDevice, IInputStateCallbackReceiver
Remarks
Note that a pointer may have "multi-point" ability as is the case with multi-touch where multiple touches represent multiple concurrent "pointers". However, for any pointer device with multiple pointers, only one pointer is considered "primary" and drives the pointer controls present on the base class.
Properties
current
The pointer that was added or used last by the user or null
if there is no pointer
device connected to the system.
Declaration
public static Pointer current { get; }
Property Value
Type | Description |
---|---|
Pointer |
delta
Declaration
public Vector2Control delta { get; }
Property Value
Type | Description |
---|---|
Vector2Control |
position
The current pointer coordinates in window space.
Declaration
public Vector2Control position { get; }
Property Value
Type | Description |
---|---|
Vector2Control |
Remarks
Within player code, the coordinates are in the coordinate space of the
Within editor code, the coordinates are in the coordinate space of the current
press
Whether the pointer is pressed down.
Declaration
public ButtonControl press { get; }
Property Value
Type | Description |
---|---|
ButtonControl |
Remarks
What this means exactly depends on the nature of the pointer. For mice (Mouse), it means that the left button is pressed. For pens (Pen), it means that the pen tip is touching the screen/tablet surface. For touchscreens (Touchscreen), it means that there is at least one finger touching the screen.
pressure
Normalized pressure with which the pointer is currently pressed while in contact with the pointer surface.
Declaration
public AxisControl pressure { get; }
Property Value
Type | Description |
---|---|
AxisControl |
Remarks
This is only meaningful for pointing devices that support pressure. Mice do not, pens usually do, and touch usually does on mobile platforms.
Note that it is possible for the value to go above 1 even though it is considered normalized. The reason is that calibration on the system can put the maximum pressure point below the physically supported maximum value.
radius
Declaration
public Vector2Control radius { get; }
Property Value
Type | Description |
---|---|
Vector2Control |
Methods
Accumulate(InputControl<Single>, Void*, InputEventPtr)
Declaration
protected static void Accumulate(InputControl<float> control, void *oldStatePtr, InputEventPtr newState)
Parameters
Type | Name | Description |
---|---|---|
InputControl<System.Single> | control | |
System.Void* | oldStatePtr | |
InputEventPtr | newState |
FinishSetup()
Declaration
protected override void FinishSetup()
Overrides
MakeCurrent()
Declaration
public override void MakeCurrent()
Overrides
OnEvent(InputEventPtr)
Declaration
protected void OnEvent(InputEventPtr eventPtr)
Parameters
Type | Name | Description |
---|---|---|
InputEventPtr | eventPtr |
OnNextUpdate()
Declaration
protected void OnNextUpdate()
OnRemoved()
Declaration
protected override void OnRemoved()
Overrides
Explicit Interface Implementations
IInputStateCallbackReceiver.OnNextUpdate()
Declaration
void IInputStateCallbackReceiver.OnNextUpdate()
Implements
IInputStateCallbackReceiver.OnStateEvent(InputEventPtr)
Declaration
void IInputStateCallbackReceiver.OnStateEvent(InputEventPtr eventPtr)
Parameters
Type | Name | Description |
---|---|---|
InputEventPtr | eventPtr |