Slowing game speed to reach target fps?

Hi, I’m new here in the forums, but have basic knowledge of Unity3D.

I’m trying to make the game always reach a certain fps (frames per second, not first person shooter) even if the player’s pc is crappy. I’m not talking about VSync here, but slowing down the game to make sure it is smooth.

It’s like running a game under it’s requirements. It lags and possibly go slow-mo.

One example of what I’m trying to achieve is Hotline Miami. Try playing it with a beefy computer and you’ll realize everything’s slowed down (even bullets and movements…).
Well, I’m considering to use Time.timeScale but I can’t figure it out to match fps and all those things.

The reason I’m trying to do this is I need to repeat some player movements again and again but if the fps isn’t constant, the repeating player movements matches the time exactly. Like during the 10th second, player will jump, instead of the 600th frame.


I strongly recommend multiplying your movements by Time.deltaTime instead of slowing the whole game down.

Time.deltaTime is the time [in seconds] passed since the last frame update. If you have a fast computer, this number will be very small. If you have a slow computer, this number will be higher.
So instead of moving the player by X units, move it by X * Time.deltaTime units. This will make the player move in the same pace in every computer.

If I didn’t understand your question well and you actually meant limiting the FPS, use this:

Application.targetFrameRate = 30;

The answers are in the comments in the answer of Bip901.

Basically, use FixedUpdate() to collect data and replay data


Thanks for all the help