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(); } } 
  • one
    Nobody bothers you to make a counter and count how many times the user clicked. You can write a small class or method in which you describe: how much time is allowed between tapes, so that it is considered as a row, and after what time to reset the counter .... although even the last value will be needed ... more than the designated time has passed? then reset the counter. Otherwise, when TouchPhase.Began add a counter and a timer (which monitors how much time has passed) - Alexey Shimansky
  • one
    Well, then just start a counter variable and every time TouchPhase.Began add it ..... everything ..... although judging by the task, you have to do as I say .............. and touchCount is not so many times pressed, but how many tachets were at the same time - Alexey Shimansky
  • one
    And what do you mean by the word "touch" then? Unclear. Touch is kind of like a touch. Or do you mean something else? And then at the moment some kind of nonsense. You consider the numbering of the tachets and if there is a certain number of them, then you need to click on the touch O_o - Alexey Shimansky
  • one
    Tachets have phases ..... docs.unity3d.com/ScriptReference/TouchPhase.html ......... Began --> A finger touched the screen. ....... that's what it should be taken into account instead of a mouse ....... if someone touched, then add the gts+ counter - Alexey Shimansky
  • one
    if (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 a Began phase, then you want to do what you want - Alexey Shimansky

0