- Home /
 
 
               Question by 
               StalkerSheep · Jan 09, 2013 at 12:40 AM · 
                iosipadtouches  
              
 
              How do I detect no touches on the screen?
I've tried a couple of things and nothing seems to work.
Input.touchcount==0
Input.touches==null
Input.touches[0]==null
Input.touches[0]==false
Input.touches.Length==0
               Comment
              
 
               
              The first (if it were touchCount) and last ones should work. What is the code around that?
Are you using javaScript? With it really spelled incorrectly as "touch lower-case count"?
(javascript will sometimes let you use the wrong name, then do arbitrary things when it runs.)
Answer by prototype7 · Jan 09, 2013 at 04:51 AM
Example in C#
     private bool kiss = false;
     private Touch touch;
     
     void Update () {
         kiss = false;
         if (Input.touchCount > 0)
         {
             touch = Input.GetTouch(0);
             kiss = touch.tapCount > 0 ? true : false;
             // if you touch
             if (kiss)
             {
                  
             }
             // if touch ended
             if (touch.phase == TouchPhase.Canceled || touch.phase == TouchPhase.Ended)
             { 
                 // do something
             }
         }
     }
 
              Your answer