- Home /
 
 
               Question by 
               Marsa-Palas · Aug 24, 2015 at 11:43 AM · 
                androidupdateinput.touch  
              
 
              Update executes on touch
I am making a tetris game and the problem is with figures falling down. So, a figure should fall down one unit when timer is charged or when user moves a finger on the screen (I've put code that does that).
I built an application for android, installed the game, run it and figures only move down when finger moves. It looks like Update doesn't get called unless finger is moved (???) On the other hand, when I throw out DownKeyPressed() call, figure falls every 0.3 sec as it should.
Is it possible there is some bug with this, or I was doing something terribly wrong?
 public void Update()
 {
 // ...
         if (timer >= 0.3f || DownKeyPressed ())
         {
             timer = 0;
             MoveFigure();
         }
 // ...
            timer += Time.deltaTime;
 }
 
 private bool DownKeyPressed()
 {
 #if UNITY_ANDROID
         if(Input.GetTouch(0).phase == TouchPhase.Moved)
         {
             return true;
         }
         return false;
 #else
         if(Input.GetKey(KeyCode.DownArrow))
             return true;
 #endif
 }
 
              
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Marsa-Palas · Aug 25, 2015 at 02:56 PM
I solved it by putting if(Input.touchCount >= 1) before checking the touch phase.
Your answer