Class Touchscreen
A multi-touch surface.
Inherited Members
Namespace: UnityEngine.InputSystem
Syntax
public class Touchscreen : Pointer, IInputStateCallbackReceiver
Remarks
Note that this class presents a fairly low-level touch API. When working with touch from script code,
it is recommended to use the higher-level
Properties
current
The touchscreen that was added or updated last or null if there is no touchscreen connected to the system.
Declaration
public static Touchscreen current { get; }
Property Value
Type | Description |
---|---|
Touchscreen |
primaryTouch
Synthetic control that has the data for the touch that is deemed the "primary" touch at the moment.
Declaration
public TouchControl primaryTouch { get; }
Property Value
Type | Description |
---|---|
TouchControl |
Remarks
This touch duplicates touch data from whichever touch is deemed the primary touch at the moment.
When going from no fingers down to any finger down, the first finger to touch the screen is
deemed the "primary touch". It stays the primary touch until released. At that point, if any other
finger is still down, the next finger in
Having this touch be its own separate state and own separate control allows actions to track the
state of the primary touch even if the touch moves from one finger to another in
touches
Array of all TouchControl on the device.
Declaration
public ReadOnlyArray<TouchControl> touches { get; }
Property Value
Type | Description |
---|---|
ReadOnlyArray<TouchControl> |
Remarks
Will always contain MaxTouches entries regardless of which touches (if any) are currently in progress.
Methods
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 |