Search Unity

Input.touchCount not detecting touches on android with URP

Discussion in 'Input System' started by unity_zWb7yb2_DsTdZQ, Mar 30, 2021.

  1. unity_zWb7yb2_DsTdZQ

    unity_zWb7yb2_DsTdZQ

    Joined:
    Jul 22, 2019
    Posts:
    1
    Edit : I have no idea why I have this random name, sorry for that...

    Hi,

    I have a very weird problem (most likely a bug but I prefer to double check with you).

    I have somewhere in my scene :

    Code (CSharp):
    1.     void Update()
    2.    {
    3.         Debug.Log(Input.touchSupported);
    4.         Debug.Log(Input.acceleration);
    5.         Debug.Log("Touches : " + Input.touchCount);
    6.    }
    And in another component :
    Code (CSharp):
    1. using UnityEngine.Rendering.Universal;
    2.  
    3.     public class MyClass: MonoBehaviour
    4.     {
    5.         UniversalAdditionalCameraData m_uiCamData = null;
    6.      }
    7.  
    On android, I always get Touches : 0 no matter how many fingers I use on the screen.
    If I get rid of UniversalAdditionalCameraData and its include, then touchCount works fine (touchSupported is true and the acceleration work in both cases).
    To be clear, I don't do anything with the UniversalAdditionalCameraData variable, just the fact that it exists somewhere breaks Input.touchCount (and Input.GetTouch).

    Does anyone know if it's an intended behaviour and if there is a workaround ?