- Home /
sprite moves jerky no matter on frame rate
I saw many posts on that problem but nobody has a real solution (even Unity representatives keep silence). I created typical 'hello world' scene that contains only one game object with sprite and Move script attached to it (no any physics).
class Move : MonoBehaviour
{
public Vector2 speed = new Vector2(-3f, 0);
void Awake()
{
QualitySettings.vSyncCount = 0;
Application.targetFrameRate = 30;
}
void Update()
{
Vector3 movement = speed * Time.deltaTime;
this.transform.Translate(movement);
}
}
First of all, 30 fps is enough to see any movement really smooth. I played a lot of 3d action games at 30 fps and everything was smooth. Running that scene at 30 fps causes twitches/jittering. Increasing targetFrameRate to 60 or whatever higher fps makes game more stable:
1) seems less sprite jumping/jerks.
2) but new artifact appears - lags at every 1-2 seconds are happen there.
Only turning on vsSyncCount=1 (display frame rate is 60 Hz) seems makes game without jerks and lags. Strange thing is that the same 60 fps but with vsync on/off gives different experience. I can't figure out why ?
Currently I am using vSyncCount=1 which gives much better experience (seems no lags and jittering).I want my game to run at 30 fps smoothly (it is also needed to make a game trailer as well as supporting devices where frame rate is locked to max of 30 fps and at all it should work very smooth at 30 fps). How do you guys achieve that ?
NOTE: Also noticed that sprite jerks more in Editor than in Standalone Builds. Why so ?P.S. vSyncCount=2 produces 30 fps but game twitching.
Answer by Dray · Jan 18, 2018 at 07:39 PM
void FixedUpdate()
{
Vector3 movement = speed * Time.fixedDeltaTime;
this.transform.Translate(movement);
}
done.
Read more here:
cheers :)
Your answer
Follow this Question
Related Questions
Unity 2018 Stuttering: Vsync Issue with dual monitor? 1 Answer
Why is my transform "stuttering" when I move it? 2 Answers
micro Jittering, stuttering... bug of unity? 2 Answers
Gfx.WaitForPresent is limiting fps to 30-45 with Application.targetFrameRate = 60; 1 Answer
Gfx.waitForPresent causing massive lag spikes in editor 8 Answers