Build Speed Problem

The problem I have at the moment is when I tell unity to build and run my game it makes my objects move 3 to 4 times faster then they do in the editor. I have tried deleting the build and rebuilding it multiple times but no luck.

Any help is greatly appreciated.

That's normal, the editor runs considerably slower than a web player or stand alone. What you need to do is add a fixed time multiplier to your code to make things move relative to actual time instead of frame rate.


for moving forward:

transform.position += transform.forward*moveSpeed*Time.deltaTime;

deltaTime is the time since the last frame

Is your object speed dependent on framerate? The framerate is usually faster in a build than in the editor, so if the movement speed isn't independent from the framerate then it would move faster.

For Example;

Dependent on framerate (moves 1 meter per frame);

function Update () {
    transform.Translate (0, 0, 1);


Not dependent (by multiplying the amount moved by Time.deltaTime, which is how long the last frame was, the movement speed becomes 1 meter per second rather than 1 meter per frame);

function Update() {
    transform.Translate (0, 0, 1*Time.deltaTime);