Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

TouchId with the new Input System

Discussion in 'Input System' started by CyberAngel, Sep 5, 2022.

  1. CyberAngel

    CyberAngel

    Joined:
    Oct 4, 2014
    Posts:
    125
    Ok, so I have a mapping setup that works with Mouse Left Click and Touch. When either hits the screen it then checks to see if it is over a UI and then runs no further.

    The mouse side of it works fine, and the issue I am now running into is that the touch ide side of it doesn't work and I am at a loss to find how to do this.

    In the old way you would do something like this.

    Code (CSharp):
    1.  
    2.         foreach (Touch touch in Input.touches)
    3.         {
    4.             int id = touch.fingerId;
    5.             if (EventSystem.current.IsPointerOverGameObject(id))
    6.             {
    7.                 return;
    8.             }
    9.         }
    10.  
    The mapping for both the left and Primary Touch is set to Button for the Action Type.
     
    AlirezaFatemi likes this.
  2. CyberAngel

    CyberAngel

    Joined:
    Oct 4, 2014
    Posts:
    125
    I take it nobody knows how to do this.

    The binding is a button with two options Left Mouse Click and Touch */Press (this might not be right), so basically I want to check if the touch is over a UI, I can do the mouse easy enough but there is little to no explanation of guides how to do this with

    Code (CSharp):
    1.  
    2. public void OnClick(InputAction.CallbackContext context)
    3. {
    4. }
    5.