How to make GetTouch(1) not depending on GetTouch(0) and touchCount

I'm making an app which asks to keep touch 2 things at same time, but sometimes only one. So my problem is: GetTouch(1) depends on GetTouch(0) and touchCount.

If I release 1 time the getTouch(0) : getTouch(1) will not be called anymore.

I don't know if I'm clear so here is my code:

if (Input.touchCount > 0)
            {
                Touch touch = Input.GetTouch(0);
                if (touch.phase == TouchPhase.Began)
                {
                }
                if (touch.phase == TouchPhase.Ended)
                {
                }

                if (Input.touchCount == 2)
                {
                    Touch touch_ = Input.GetTouch(1);
                    if (touch_.phase == TouchPhase.Began)
                    {
                    }
                    if (touch_.phase == TouchPhase.Ended)
                    {
                    }
                }
}

How can I do to still keep the Touch(1) even without Touch(0) Pressed please ? Just keep doing my stuff during "touch_.phase == TouchPhase.Began". Thank you in advance.



Read more here: https://stackoverflow.com/questions/66991962/how-to-make-gettouch1-not-depending-on-gettouch0-and-touchcount

Content Attribution

This content was originally published by Kawak_ at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: