Select Page

Unity Simple Slow Motion Effect Guide

Unity Simple Slow Motion Effect Guide

Hello, and welcome to another amazing and simple guide that will help you accomplish your slow motion effects in your unity game. This guide is written in C#.

So, you’re here because you need help with one of the following:

  • Creating a slow motion effect with unity
  • Create slow motion button
  • Making a slow motion effect ontrigger

Well, whatever the case may be, this is the guide to get you there. Did I forget to say “simple”? because this guide will be about 15 lines of code and TADA! We are done.

 

In Unity: Create a new C# script of use an existing one, but let pretend the script is called “slowmoScript”.

In your slowmoScript, make two public floats (so you can edit them for your own spec).

Create these:

public float fullspeed = 1;

public float slowspeed = 0.3;

 

Now you need two methods/functions, one to start the slow motion and one to stop it and return to normal speed.

Public void startSlowMotion() and, endSlowMotion()

 

Finally, So simply set Time.timeScale to fullspeed or slowspeed and you’re done.

Example:

 public class slowmoScript : MonoBehaviour
{

    public float fullSpeed = 1;
    public float slowSpeed = 0.3f;


    public void startSlowMotion()
    {
        Time.timeScale = slowSpeed;
    }


    public void endSlowMotion()
    {
        Time.timeScale = fullSpeed;
    }

}

What do I do now?

Call your startSlowMotion function whenever you need to, then call the endSlowMotion to return to normal time. Keep in mind that your normal time may not be 1, so set the fullSpeed variable to match your game specs.

About The Author

Leaton Mitchell

Being smart doesn't count if you do not share your knowledge.