How do I stop mobile touch input from giving more than one output per tap?
As of now, when I touch my screen, I get about 5-10 outputs. In addition, I have a swiping script, and when I begin the swipe, the tap if statement activates.
I need a way to add resistance and to prevent the tap if statement from running when I swipe.
if (Input.touchCount == 1 && idle == true)
{
p = true;
pSound.Play();
Debug.Log("Tap");
}
else if (Input.touchCount == 0)
{
p = false;
}
Answer by MD_Reptile · Apr 30, 2016 at 11:04 PM
You will need to check the state of the touch. You can use TouchPhase to determine if a touch just came down, or is held stationary, or moving around...and so on.
Might get this free asset and read how this guy handles a lot of different input types: https://www.assetstore.unity3d.com/en/#!/content/30111
Your answer
Follow this Question
Related Questions
When The Screen Is Touched Jump 0 Answers
How to detect a swipe in ANY direction? 1 Answer
Unity and Android input touch? 1 Answer
Moving character with touch buttons (Android) 1 Answer
Android Touch Input not working in Build 3 Answers