Lerp deltaTime sped up in build - Unity 5

Has anyone noticed that if you lerp or slerp an object with deltaTime, your object moves faster in the actual build.

It seems to be sped up by almost 2x.

Here is the pretty standard code I am using to lerp:

transform.position = Vector3.Lerp (transform.position, SlotToMoveTo.transform.position, MoveTime * Time.deltaTime);
transform.rotation = Quaternion.Lerp (transform.rotation, SlotToMoveTo.transform.rotation, MoveTime * Time.deltaTime);

Those lines are in the Update() function.

Does anyone know why this is slower in the editor player?

Although the code you’ve posted is commonly-used, it’s got a major flaw in it because it is not framerate independent.

To demonstrate why, let’s just assume that MoveTime is 1, so that it can be removed from the equation, that the initial transform.position is (0,0,0), and the SlotToMoveTo.transform.position is (100,0,0), so we’ll only consider the Lerp in the x dimension.

Now suppose that your game is running at 60FPS. So deltaTime is 1/60 = 0.016, and that’s the fraction of the remaining distance that your transform moves in each frame. After one second, 60 frames have passed, so 1/60th of the remaining distance has been taken away 60 times. So, the remaining distance from the target after one second = 100 * (59/60)^60 = 36.48. Since that’s the remaining distance to the target, the x value must be (100 - 36.48) = 63.52.

Now, what if your game was running at 15FPS instead? Now, in one second, 1/15th of the remaining distance is taken away 15 times. So, the remaining distance from the target = 100 * (14/15)^15 = 35.53. In other words, the x value is (100 - 35.53) = 64.47 instead.

I’m not sure this would account for the 2x difference you’re apparently seeing, but for more discussion and the “correct” way to use Lerp, you might want to see Using Vector3.Lerp() correctly in Unity — One Man's Trash is Another Man's Blog.