Touch polling
The EnhancedTouch.Touch class provides a polling API for touch input similar to UnityEngine.Input.touches. You can use it to query touches on a frame-by-frame basis.
Important
Don't use Touchscreen for polling. If you read out touch state from Touchscreen directly inside of the Update or FixedUpdate methods, your application misses changes in touch state.
Enable enhanced touch
Because the API comes with a certain overhead due to having to record touches as they happen, you must explicitly enable it. To do this, call EnhancedTouchSupport.Enable:
using UnityEngine.InputSystem.EnhancedTouch;
// ...
// Can be called from MonoBehaviour.Awake(), for example. Also from any
// RuntimeInitializeOnLoadMethod code.
EnhancedTouchSupport.Enable();
Note
You don't need to enable EnhancedTouchSupport if you're using the Touchscreen class. You only need to call EnhancedTouchSupport.Enable if you want to use the EnhancedTouch.Touch] API.
Read all touches
To get all current touches from the touchscreen, use EnhancedTouch.Touch.activeTouches. You must first enable enhanced touch support.
For example:
using Touch = UnityEngine.InputSystem.EnhancedTouch.Touch;
public void Update()
{
foreach (var touch in Touch.activeTouches)
Debug.Log($"{touch.touchId}: {touch.screenPosition},{touch.phase}");
}
You can also use the lower-level Touchscreen.current.touches API to read all touches.