I am working on a very simple vertical scrolling game for Unity iOS. My game is experiencing inconsistent jittering. I have searched the web extensively looking for a solution without any luck. I am using Unity version 5.3.4 f1.
The Game
- A character is falling down. We are using unity's character controller to move the character in
Update()
(Time.deltaTime
is being multiplied). - Camera is following the character in
LateUpdate()
(usingVector3.Lerp()
to follow). - Since the character is moving down, the obstacles seem to be moving upward the screen.
- There is 1 directional light in the scene, setup for real time shadows. Shadow quality is High and Hard shadows.
- There are no rigid bodies in the scene. And there are no major spikes in the profiler.
- We have very simple geometry and very few draw calls/ set pass calls (avg. 7 set pass calls).
- We have constant 60 fps.
- Since we are running on iOS vSync is by default On and cannot be disabled.
The Problem
- The background elements/ obstacles (Trees, rocks etc.) start jittering for no apparent reason. The behaviour is inconsistent, some times it jitters and sometimes it does not.
- Even when it does not jitter we experience small stuttering when user gives input via touch.
What we have tried
- We have tried all combinations of
Update()
,LateUpdate()
,FixedUpdate()
,Time.deltaTime
Time.smoothDeltaTime
, Lerp, reducing the scene to a few cubes and removing all colliders and triggers. - We have already studied the following threads: Link1, Link2, Link3 and countless other threads.
- Initially our game was running at the default 30 fps. But after some research it seemed that our problem was due to the difference between "Frame Rate" and "Screen Refresh Rate". (to understand this issue see the following LINK). Since iOS devices have a refresh rate of 60Hz we have set our target frame rate to 60 and our game maintains a constant 60 fps.
- After setting the target frame rate to 60 the jitter has improved but now it is inconsistent.
I am all out of ideas. Any help or pointer will be highly appreciated.
Thanks in advance.