- Home /
Touches on a touch monitor aren't creating Touch objects nor incrementing Input.touchCount
I'm developing some code so that an application will work with mouse & keyboard as well as with touch monitors. Currently, holding the left-click button will let the user move the camera, FPS-style. I would like to add gesture controls so that a touch held on the screen would let the user move the camera in a similar fashion.
The first statement in the update function is
if (Input.GetMouseButton(0) == true|| Input.touchCount == 1)
This statement evaluates as true whether I use the mouse or the touch screen, which seemed good at first. Then I realized that the next statement,
if (Input.touchCount == 1)
never triggers. Instead, touches are interpreted as mouse left-clicks. This causes the first statement to succeed on a touch, but not the second. So the current behavior right now is that holding the mouse left-click button & dragging will swivel the camera, and touching & dragging on the screen does nothing. Any ideas on why this is happening and how to fix it?
The closest I found on these forums was http://answers.unity3d.com/questions/1074752/inputtouchcount-always-zero-on-windows-touch-scree.html but that didn't offer any straightforward solution. Any help would be appreciated!
Your answer
Follow this Question
Related Questions
Touch controls for Pong based video games for Android 0 Answers
Working with screen's touch limit 0 Answers
Problem in multi touch 0 Answers
How do I move an object with my finger?[C#] 1 Answer
Player can jump on non ground items 1 Answer