Answer the question
In order to leave comments, you need to log in
Unity: tap in place?
Such a thing - it is necessary to determine the tapas on the screen, and those that occurred in one place.
That is, a person tapped on the screen without moving his finger anywhere.
There is a tapCount, but it works for any events with a touch, that is, it disappears.
So far, I made a crutch for myself in the form of something like this:
private Vector2 m_StartTouch;
void Update () {
if(Input.touchCount > 0) {
Touch touch = Input.GetTouch(0);
if(touch.phase == TouchPhase.Began) {
m_StartTouch = touch.position;
} else if(touch.phase == TouchPhase.Ended) {
Vector2 endPosition = touch.position - m_StartTouch;
if(endPosition.magnitude <= 0) {
}
}
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question