- Home /
Android touch input lag
Hello people!
I'm quite new to unity so please bear with me xD, and my english ain't that good anymore.
So far have been trying to make a game where you have to tap a object for it to bounce in the oposite direction of where it has been tapped. After trial and error have made that part possible but even before that the tap function has been lagging. I'm not using touch and touches functions and maybe that is the issue, so far i'm using input.getmousebuttondown but i don't want to believe that because of that the touch function on the gameobjects fells as if it would a disappear for a few seconds.
My big problem is the touch lag on the gameobject for android interfaces. For the start everything works fine, but after a short while it refuses to accept touch, everything continues to run as smooth as before but i cant tap the gameobject anymore, after a second or few the touch starts to work again as if nothing happened, but in a few seconds it repeats again, the whole point of the game is being able to tap it yet this makes the game worthless. The only thing i have found is that its not possible to solve this problem, yet all the links of the same problem are 1-2 years ago so maybe there is still yet hope! x) As previously noted it may be because i'm not using touch and touches functions or that can't be the issue of this?
Here is the code for my touch function:
void Touch () {
if (Input.GetMouseButtonDown(0)) {
RaycastHit2D hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
if(hit.collider != null) {
if(hit.collider.gameObject==gameObject ) {
testpos = Camera.main.ScreenToWorldPoint(Input.mousePosition);
if(transform.position.x > testpos.x){
testx = transform.position.x - testpos.x;
body.angularVelocity = body.angularVelocity - 100;
body.velocity = new Vector2(2*testx,100);
} else if(transform.position.x < testpos.x){
testx = testpos.x - transform.position.x;
body.angularVelocity = body.angularVelocity + 100;
body.velocity = new Vector2(2*(-testx),100);
} else {
body.velocity = new Vector2(body.velocity.x, 100);
}
CheckSkaitli();
}
}
}
}
Thank you in advance!
John
Your answer

Follow this Question
Related Questions
Android Lag ( Movement via GUI Buttons ) 0 Answers
How do I prevent / deal with input lag on a touch interface? 3 Answers
Touch Input madness 2 Answers
GoogleVR vs GearVR - frame dropping 0 Answers
Unity to android (game very laggy) 1 Answer