Hi
Short version:
When I drag an object in circles around the screen on my iPhone and iPad continuously for a little while, every couple of minutes the object stutters for 5-15 seconds. The screen frame rate is a solid 60 fps, but the touch input goes all choppy, so everything looks butter-smooth except for the object I’m dragging across the screen, which moves all jittery.
I think the problem is that the touch input works at a different rate than the screen, as suggested here:
http://answers.unity3d.com/questions/393417/camera-not-moving-smoothly-on-drag.html
Detailed version:
A few weeks ago I encountered an issue with unity that has become a big problem for me.
The problem is that touch input stutters for about 5-15 seconds every couple of minutes.
I’ve tried it on a couple of iPhones and iPads and can reproduce it 100% of the time.
Note that it’s not that the frame rate drops (on the contrary, it’s 60 fps all the time). The problem is that the touch input goes all jittery for 5-15 seconds and then goes back to being butter-smooth. It looks like the touch input refresh rate dropped from 60hz to 10hz for a few seconds.
This is a problem for me because in my game you’re always dragging the main character across the screen with your finger, so it looks awful when the main character moves all jittery around the screen as you drag it.
This is the script:
void Update () {
if (Input.touchCount == 1)
{
Touch touch = Input.GetTouch(0);
if (touch.phase == TouchPhase.Moved)
{
Ray ray0 = Camera.mainCamera.ScreenPointToRay(touch.position);
transform.position = ray0.origin + ray0.direction * (-ray0.origin.z);
}
}
}
I think the problem is that the touch screen runs at its own refresh rate, like this thread suggests:
http://answers.unity3d.com/questions/393417/camera-not-moving-smoothly-on-drag.html
However the suggested solution doesn’t solve the stuttering, and it doesn’t make a lot of sense to me why it would.
Anyway, this is the game if you want to see why the stuttering is a deal breaker for me (though you can’t see the stuttering in the video it’s really apparent IRL)
http://www.youtube.com/watch?v=1hOmgLBqBwQ#t=0
And you can download the project from here:
http://dl.dropbox.com/s/9r4o16zcw0q8fxx/touchJitter2.zip
I’m using iOS 7 and unity 4.3.2.
Please give me a hand if you know how to solve this, I’ve been struggling with it for a good couple of weeks. I’ve tried a few different things, even smoothing the input but it still looks awful.
Thanks for reading.
-Nacho.