Time.DeltaTime works inconsistently

I solved the problem with changing it for fixedDeltaTime, but what i don’t understand - is why original one behaves like that? one moment movement is normal - second later movement speed is 5-6 times higher

Hi urdenster,

What are you referring to?

in 88. Movement & Time.deltaTime:
var deltaX = Input.GetAxis(“Horisontal”) * Time.DeltaTime;

used for fixing inconsistency in movement speed on different machines, when i do same on the player object, the movement speed becomes inconsistent, 10-15 sec it behaves normal, then suddenly it speeds up

my code is a bit different, but i don’t think it’s the reason:

 void Update()
 {
   
    transform.Translate(deltaX, 0, 0);
 }


private void OnMove(InputValue input)
{
    deltaX = input.Get<Vector2>().x * Time.fixedDeltaTime * movementSpeedModifier;
}

ok, i found what my mistake was, it was because of calculating DeltaTime outside of update method.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms