vesku
vesku

Reputation: 31

Movement in Unity is lagging every few seconds and movement looks jumpy

I made a game in Unity where an apples falling from top to bottom. The problem is that they don't fall smoothly. In every seconds they move crappy like this:

down, down, down, UP, down, down, down ,UP, down, down, down...

Looks like in every few seconds object jumps up and then falling like it should do and then again jumps up...

The code is very simple:

function Update () {
    transform.position.y -= speed * Time.deltaTime;
}

I tried turning off VSync, tried FixedUpdate(with Time.fixedDeltaTime), LateUpdate, Time.smoothDeltaTime, transform.Translate, MoveTowards, Vector3.Lerp, turning on Interpolate of RigidBody, tried even change Time settings and nothing helps even when add a Plane in New Scene and attach this script to Plane.

Before a moment I tried to attach rigidbody2D to Quad and see what will happens and there is still lag when Quad is falling down even without any code. This makes me wondering why this is happening?

Upvotes: 1

Views: 2847

Answers (1)

S.Richmond
S.Richmond

Reputation: 11558

Try using Time.smoothDeltaTime.

Upvotes: 0

Related Questions