Class Finger
A source of touches (Touch).
Namespace: UnityEngine.InputSystem.EnhancedTouch
Syntax
public class Finger
Remarks
Each Touchscreen has a limited number of fingers it supports corresponding to the total number of concurrent touches supported by the screen. Unlike a Touch, a Finger will stay the same and valid for the lifetime of its Touchscreen.
Note that a Finger does not represent an actual physical finger in the world. That is, the same Finger instance might be used, for example, for a touch from the index finger at one point and then for a touch from the ring finger. Each Finger simply corresponds to the Nth touch on the given screen.
Properties
currentTouch
The currently ongoing touch for the finger or default(Touch) (with valid being false)
if no touch is currently in progress on the finger.
Declaration
public Touch currentTouch { get; }
Property Value
| Type | Description |
|---|---|
| Touch |
index
Index of the finger on screen. Each finger corresponds to the Nth touch on a screen.
Declaration
public int index { get; }
Property Value
| Type | Description |
|---|---|
| Int32 |
isActive
Whether the finger is currently touching the screen.
Declaration
public bool isActive { get; }
Property Value
| Type | Description |
|---|---|
| Boolean |
lastTouch
The last touch that happened on the finger or default(Touch) (with valid being
false) if no touch has been registered on the finger yet.
Declaration
public Touch lastTouch { get; }
Property Value
| Type | Description |
|---|---|
| Touch |
Remarks
A given touch will be returned from this property for as long as no new touch has been started. As soon as a new touch is registered on the finger, the property switches to the new touch.
screen
The screen that the finger is associated with.
Declaration
public Touchscreen screen { get; }
Property Value
| Type | Description |
|---|---|
| Touchscreen | Touchscreen associated with the touch. |
screenPosition
The current position of the finger on the screen or default(Vector2) if there is no
ongoing touch.
Declaration
public Vector2 screenPosition { get; }
Property Value
| Type | Description |
|---|---|
| Vector2 |
touchHistory
The full touch history of the finger.
Declaration
public TouchHistory touchHistory { get; }
Property Value
| Type | Description |
|---|---|
| TouchHistory |
Remarks
The history is capped at maxHistoryLengthPerFinger. Once full, newer touch records will start overwriting older entries. Note that this means that a given touch will not trace all the way back to its beginning if it runs past the max history size.