One way is to access the InputSystem more directly.
You might be looking for TouchPhase or use the Finger combined with the EnhancedTouch.
using UnityEngine;
using UnityEngine.InputSystem.EnhancedTouch;
using Touch = UnityEngine.InputSystem.EnhancedTouch.Touch;
public class TouchDemo : MonoBehaviour
{
private void OnEnable()
{
EnhancedTouchSupport.Enable();
}
private void OnDisable()
{
EnhancedTouchSupport.Disable();
}
private void Update()
{
foreach (var touch in Touch.activeTouches)
{
// Only respond to first finger
if (touch.finger.index == 0 && touch.isInProgress)
{
// TODO
}
}
}
}
Edit: See the Touch struct for more information about the various states of a Touch.