Course contentsShow
← Unity Game Development
Lesson 418 of 8286. Animation and CinemachineFree lesson

Implementing Time Dilation for Cinematic Impact

Manipulate the local time scale within a timeline to create dramatic slow-motion effects during key action sequences.

In this lesson, you will learn how to manipulate the Time.timeScale property within Unity Timeline to craft high-impact, slow-motion sequences that amplify the drama of your in-game cutscenes.

The Concept of Time Dilation

While Unity’s Time.timeScale is a global property, we can influence it during specific segments of a Timeline to create "bullet-time" effects. By modulating how fast time flows for the game world during a cinematic, you can emphasize key impacts, dodges, or emotional beats without needing to manually animate every single frame at half-speed.

Implementing via Timeline Signals

Since Timeline tracks play back over time, the cleanest way to trigger time dilation is by using Signal Emitters. You can place an emitter at the exact moment a cinematic action begins, pointing to a Signal Receiver on a manager script that adjusts the Time.timeScale.

Here is a simple approach to handle the transition:

public class TimeManager : MonoBehaviour
{
    public void SetTimeScale(float newScale)
    {
        // Smoothly adjust time; in a full system, you might use a Coroutine here
        Time.timeScale = newScale;
        // Fix the FixedDeltaTime to maintain physics stability
        Time.fixedDeltaTime = 0.02f * Time.timeScale;
    }
}

Cinematic Integration

  1. The Lead-in: Place a Signal Emitter a few frames before the action peaks to set the timeScale to a lower value (e.g., 0.2f).
  2. The Impact: During this window, your camera movements—handled by your Cinemachine Virtual Cameras—will feel more deliberate and heavy. Because you have already mastered syncing cameras with Timeline, the slow-motion frames will allow the audience to appreciate the pathing and target framing you’ve built.
  3. The Reset: Place a second Signal Emitter immediately after the dramatic sequence concludes to return Time.timeScale to 1.0f, snapping the scene back to real-time flow.

Note: Always remember to adjust Time.fixedDeltaTime whenever you change Time.timeScale. If you don't, your physics calculations (like projectiles or cloth simulation) may become jittery or unstable during the slow-motion effect.

Key Takeaway: By using Signal Emitters to adjust Time.timeScale at precise moments in your Timeline, you can create professional, cinematic slow-motion transitions that heighten the emotional impact of your action sequences.