- Home /
Question by
SergiusGee · Jan 21, 2013 at 06:47 PM ·
iosiphonetouchunity 4
TouchPhase.Stationary lags on iOS
I have this code in my GUI.Texture
button (I have 3 in total, each having its own class) and it gives me lags when trying to get my finger off the button and putting it on another button of the same type (that is, the touch is not detected fast enough) What could be the reason? Here is my code on C#:
void Update () {
int count = Input.touchCount;
for(int i = 0;i < count; i++)//for multi touch
{
Touch touch = Input.GetTouch(i);
if(guiTexture.HitTest(touch.position) && touch.phase == TouchPhase.Began)
{
if (player.position.x < -20) {
//get new speed
speed = Random.Range(25f,35f);
player.position = new Vector3( 20f, player.position.y, player.position.z );
}
player.Translate(0, 0, -speed * Time.deltaTime);
}
}
}
Comment