Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

Question Primary action touchscreen only listens for tap, not hold

Discussion in 'Input System' started by Blenderik, Feb 8, 2024.

  1. Blenderik


    May 14, 2013
    The Touch Action Type is Value and the Control Type is Vector2.
    I'm trying to read the delta position of the pointer on WebGL, mobile and desktop.
    Currently I switched my project to Android and using Unity Remote to test.
    This setup reports back the delta movement of the mouse when I hold and drag, otherwise it prints

    Code (CSharp):
    1.     void Start()
    2.     {
    3.         pointerActions = new PointerActions();
    4.         pointerActions.PointerActionMap.Touch.performed += onTouch;
    5.         pointerActions.Enable();
    6.     }
    7.     private void onTouch(InputAction.CallbackContext obj)
    8.     {
    9.         Vector2 delta = obj.ReadValue<Vector2>();
    10.         print("Delta: " + delta);
    11.     }
    If I press and drag on my phone, it only registers a tap and prints out the delta other than 0 only once. It says in the Derived Bindings of the Primary action that it Touch/tap, but the mouse is read continously and the touch is not. How can I change this and how can I trigger the performed only when the Modifier is triggered?