I thought that each “Input” must be correctly specified (such as Input.GetMouseButtonDown() for mouse or Input.GetTouch() for mobile-devices) but it seems that its not exactly true.
I ran into big issues about such behaviour (I needed both checks to run simultaneously in order to be able to test the game on a computer and device but I didn’t know that they would trigger both when touch is occurred). After some pointless-time-consuming actions I eventually found a solution. To differentiate the actual touch (instead of a mouse press) I should use additional check
Otherwise Unity triggers both (Yes I could split them in separate methods and use the preprocessor directives or Conditional attribute but it’s not the case).
The main question is the topic’s one. The less minor ones are: Was it made intentionally by Unity developers? Is it a bug?
Personally, I think this should be removed. Because I want to use it with UnityRemote and it doesn’t allow me to do that, it triggers my mouse input at the same time as touch input. Even though I used mouse input only for testing and it’s in a platform-dependent compilation. Just change things like they should be.
This seems inconvenient because it’s not that hard to write a part of the code with touches, yet it gives you a lot of control like fingerId, phases, position, pressure, radius…
Why would anyone even use it for mobile game (Input.Get…)? By using it, you are making things more complicated for yourself.
It’s good that you care about these things, though, it would be nice if you created separate method for this kind of behavior - like GetTouchDown(int fingerId);
This behaviour craps on touch screens. Just encountered a problem on Windows touchscreens where Input.GetMouseButton(1) is true when a second finger presses. This is deliberate behaviour?? For simplicity in creating UIs, just add an OR statement, “if touch || mouse”. Not hard. Having one line that merges the two different inputs makes it impossible to filter them, no?
Edit: There’s a flag settable
“Input.simulateMouseWithTouches = false” disables mouse simulation on touch screens. Then they work as two discrete inputs as you’d expect.