- Home /
touchcount variating on different devices
When I use the code with my Androd phone, it works just as I want. If I try my game on my dads phone, my player rotates alot faster.
My code:
if(Input.touchCount > 0){
Vector3 position = Input.touches[0].position;
float rotation = (position.x < (Screen.width / 2)) ? 10f : -10f;
transform.Rotate(0,0,rotation);
}
(This code makes my player rotate to the left if i press the left side of the screen, and rotate right if I press on the right side of the screen.)
How can I make the rotate speed the same on all devices? Appreciate answers.
Made it work: This problem was caused by different frames per second. I just limited the fps like this: Application.targetFrameRate = 60; And it works just fine.
Answer by Owen-Reynolds · Apr 07, 2015 at 02:58 PM
The second device, when running your game, has a faster frame rate than the first.
Search for things like "unity game runs too fast." That will explain the problems with moving a certain amount per-frame, and how to use Time.deltaTime to account for different frame rates.
Answer by ozturkcompany · Apr 08, 2015 at 05:26 PM
Do both of the devices have the exact same screen width? If not, it is expected. See if this was what you were missing for. Cheers.
First I thought that was the problem, so I used long time progra$$anonymous$$g my game so it's the same on every resolution. That wasn't the problem. But what Owen Reynolds said was right. Different fps amount was the problem.