Detecting finger down - Android
yo all!
Anyone know how to detect a finger press thats held down and sliding around the screen on an Android device? currently i can only detect a tap.
this is the code i have so far:
 void Update () 
     {
         int nbTouches = Input.touchCount;
 
         if(nbTouches > 0)
         {
             for (int i = 0; i < nbTouches; i++)
             {
                 Touch touch = Input.GetTouch(i);
 
                 if(touch.phase == TouchPhase.Began)
                 {
                     Ray screenRay = Camera.main.ScreenPointToRay(touch.position);
 
                     RaycastHit hit;
                     if (Physics.Raycast(screenRay, out hit))
                     {
 
                         if(hit.collider.tag == "Coin") { 
                             Destroy (hit.collider.gameObject);
                         }
                     }
                 }
 
             }
         }
 }
Answer by romatallinn · Jan 08, 2017 at 12:20 PM
Have you searched for TouchPhase? You use one of them - TouchPhase.Began. It calls only once when you touch. There are a few more that will be useful for you. For example, TouchPhase.Moved. So you know that the touch has been moved (dragged). Hope it helps!
Hi Romatallinn,
No I haven't had a look at touchPhase yet, thanks for letting me know, I'm new to the mobile thing.
cheers
Your answer
 
 
             Follow this Question
Related Questions
How can I detect a smartphone? 0 Answers
Touch on screen never detected 0 Answers
Player follow touch when holding down your finger on the screen (C#) 1 Answer
Sound Game (wave) 0 Answers
MovieTexture play on Android 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                