There is one handy thing in Unity

Input.GetMouseButton(0) 

Returns true when touching the touchscreen. How to disable it?

  • one
    Disable - no way. The guide recommends switching to TouchInput. If you need to use a universal method for processing input, but to separate the mouse from the wheelbarrow, abstract from the platform. In the case of Unity, you can describe a class and, when loading a game, write to its instance platform-specific and device-specific values. Specifically, you can enter a delegate for input, which will return coordinates, for example. Try to describe exactly what you are trying to do - maybe there are better options - eastwing
  • @eastwing Input is needed for Unity, which on all platforms will work with the keyboard and mouse. To pinch - and sprites followed him across the screen. Just when you write two different methods, one for the wheelbarrow, with FingerID, so that your fingers work correctly, everything works, and here on you - the mouse method quietly takes control, because he has absolutely no difference on FIngerID - the mouse simply does not have it. - Dmitrii
  • one
    I didn’t quite understand what it means “will work with keyboard and mouse on all platforms” - and on mobile phones too? But in general, it seems to me, without abstracting you in any way - eastwing
  • one
    I can't check now, there is no Unity at hand. You write that the mouse simply does not have a FIngerID - can this be somehow fixed in the code? For example, when using the mouse, FIngerID = null. If you can - here's the filter for you - eastwing
  • one
    So, if I understood everything correctly (and remembered), then FingerID is based on an array of Input.Touches, which depends on the touchscreen touch. Thus, if you click the mouse, FingerID will not be affected, but if you click on the touchscreen, it will be, no matter what method the touch was processed. That is, in theory , by FingerID, you can filter out the touch by checking the condition, for example: if (Touch.fingerId == -1) {// mouse processing} - eastwing

0