Unity 4.5 Interpolation Problem

My 2D physics worked perfectly in 4.3, but has not worked in any of the 4.5 versions. I recently found out the cause of the problem: some simple code that updates the Z position of my objects:

transform.position = new Vector3(
            transform.position.x,
            transform.position.y,
            newZ
);

As long as I have this code and Interpolation enabled, my objects move about half as fast and stutter a bit. It doesn’t matter if I have the code at the beginning or end of Update(), FixedUpdate(), or LateUpdate(). Does anyone have an idea for how I might be able to work around this?

Are you multiplying with Time.deltaTime ? Try using Time.smoothDeltaTime

You might also find the following thread useful:

I am not using Time.deltaTime, since the purpose of modifying the transform is simply to adjust the Z sorting, not to animate any sort of movement.

I sent a small test project to support and received the following response:

[quote]
Currently it is impossible to adjust Z position of a transform without disturbing interpolation in Unity 4.5.x, but our developers have been noticed of this issue and will consider adding a new feature which will let you do it. We cannot say when this will be implemented.
[/quote]It seems that it’s probably best that I stick with 4.3 for now.

A new update was released here which might solve your problem (620714). Please give it a try and see if your problems still occur.

The patch does fix the problem. I definitely appreciate whichever dev took the time to look into this, it was a huge problem for my project.

1 Like