If nosik = 1, when you click on the touch, the dog is triggered, everything is ok. If nosik = 2, then the touch should be pressed 2 times very quickly, almost simultaneously, otherwise the dog will not start. If nosik = 3, you need to press even faster. In short, I understand that the values of input.touchCount are reset in each frame. How can I do something so that it is considered normal, so that if, for example, nosik = 3, it would be possible to press slowly 3 times on the touch and the dog would be called?
void Update () { gts = Input.touchCount; if (gts == nosik) { dog(); } if(gts > nosik) { dog(); } }
TouchPhase.Beganadd it ..... everything ..... although judging by the task, you have to do as I say .............. andtouchCountis not so many times pressed, but how many tachets were at the same time - Alexey ShimanskyBegan --> A finger touched the screen........ that's what it should be taken into account instead of a mouse ....... if someone touched, then add thegts+counter - Alexey Shimanskyif (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began) {....that is, if the number of touches is greater than zero and the first one has aBeganphase, then you want to do what you want - Alexey Shimansky