Is this a BUG in Unity? Floating point + FixedUpdate() problem

Hi,

I’m experiencing a problem with the physics components in my game. In fact, every physics component that i made in my life have this problem, regardless of project, so maybe there’s any concept about Unity that i’m not understanding?

Imagine that i have a float called “speed” and i want it to be added on my character’s position on every update. After doing this, i realize that the movement of my character isn’t uniform, some times it’s faster and sometimes it is slower.
Than i found out that it’s because i can’t put it on Update(), i have to put it on FixedUpdate(), because Update is relative to the framerate of my game. But the problem is, even using FixedUpdate() the speed is unstable, it is more stable than using Update(), but it still isn’t right. Some times the jump of my character is longer or faster than other times.
I’m sure that isn’t a bug on my code, because it happens even in very simple implementations such as in the example cited above about a float variable “speed” being added to an object’s position.exato

I’m understanding that as i’m using FixedUpdate() I don’t need to use Time.delta. So am I doing it right? Maybe it is a problem with the Vsync property of my Project Settings?

Thanks!

Afaik, if you’re not using any physics-related methods like AddForce, you should still multiply by Time.deltaTime in FixedUpdate.

Without seeing your code I can’t be certain. If you are simply adjusting position each frame, an update method that multiplies by Time.deltatime should be consistent.

If you are reading input in FixedUpdate, you could run into reliability issues, as well.

FixedUpdate is only for physics. Use Update for standard movement, along with Time.deltaTime to achieve framerate independence.

I wouldn’t be so sure…

–Eric