How can i set the same time scale (?) in in-unity game player and game build?

Viewed 44

i have a problem with time scale or something like this. The game object should rotating, and i write this:

void Update {
transform.Rotate(Vector3.up * speed);
}

But, when i create the build of game, then in "build-edition" speed gets slower. What should i do? I can give video of this.

1 Answers

You are looking for Time.deltaTime, which outputs the time difference between the last frame and new frame.
Very much needed as a higher FPS means that more Update()s are called, resulting inconsistencies in movement.

Multiplying any movement by time-scale will help to normalize the movement across different FPS.

void Update() {
    // Will rotate significantly slower, increase the 'speed' variable.
    // But rotation speed will normalize across different FPS.
    transform.Rotate(Vector3.up * speed * Time.deltaTime);
}
Related