This page looks best with JavaScript enabled

Dynamic Game Speed - Unity Quick Tip

 ·   ·  ☕ 1 min read

You are able to modify the speed of most objects, animations and physics using a single value: Time.timeScale. Modifying this value from it’s default (1) causes the game to run slower (values less than 1) or faster (values greater than 1).

An important note of using this: adjusting the Time Scale does not effect the framerate of your game (at least not directly). It will scale the results of Time.deltaTime and Time.fixedDeltaTime and reduce the speed of animations and physics in your scene.

Some Examples

Stop Time

1
Time.timeScale = 0;

Half Speed

1
Time.timeScale = 0.5f;

Normal (Default) Speed

1
Time.timeScale = 1;

Double Speed

1
Time.timeScale = 2

References

The original Dice Roller video is here: https://www.youtube.com/watch?v=hmDF9PvMDVw

You can read more about using Time.timeScale on Unity’s documentation site: https://docs.unity3d.com/ScriptReference/Time-timeScale.html

I use the Warrior Pack Bundle 1 to demo this. It’s available as a paid and free asset.

Join the World of Zero Discord Server: https://discord.gg/hU5Kq2u


Sam Wronski
WRITTEN BY
Sam Wronski
Maker of things, currently helping build cloud things @ Microsoft. World of Zero is a personal project disconnected from my professional work. Lets make something awesome together!