i made my game and i built it .
but when i started it and played the object was faster than in unity editor
transform.localPosition -= new Vector3(0, 0, 0.1f);
in editor to finish it take 5 seconds but in game it is exacly same time when starts game.
You move your object frame-rate dependent since you move your object a fix amount every frame. So at different frame rates your object will move at different speeds. Also If the frame rates varies during the game the speed would change as well.
The solution is to move your objects time-based instead of frame based. All you need to do is multiply your desired speed with Time.deltaTime before you apply it to your position.
transform.localPosition -= Vector3.forward * speed * Time.deltaTime;
Note that “speed” in this case has an actual “unit”. It’s in “units per second”. So when using a speed of “10” your position will change by 10 every second.
“Time.deltaTime” is the time between the last frame and the current. deltaTime == 1 / framerate
and of course the reverse is true as well framerate = 1 / deltaTime
. At a framerate of 60 fps, deltaTime will be about 0.0166
. At 20 fps it would be 0.05
Oh I found a solution … but i must edit a graphic quality from fast or faster to simple or others…
any other solution?