X
X
XDecent2020-12-27 14:19:26
Unity
XDecent, 2020-12-27 14:19:26

It is necessary to distinguish between Pressing and Clamping. How to do this?

It is necessary that when pressed, event A is executed, and when clamped, event B is executed. I have a conflict in my code between pressing and clamping. Therefore, when clamping occurs, event A also occurs. I work in unity, c#, TouchPhase

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vasily Bannikov, 2020-12-27
@XDecent

Pressing/holding can be determined by the TouchPhase.Ended phase.
1. TouchPhase.Began occurs. We believe that this will be pressing
2. We begin to count the time.
3. If more than N has passed, then we consider that we will have a clamping
4. TouchPhase.Ended occurs
5. We perform clamping or pressing.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question