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

Building Robust Cutscene Skip Logic

Construct reliable systems that allow players to skip cinematic sequences while ensuring the game state remains correctly synchronized.

In this lesson, you’ll learn how to architect a reliable cutscene skip system that forces your Timeline to its final state without breaking your game’s internal logic.

The Challenge of Instant Jumping

When a player hits "Skip," you cannot simply stop the PlayableDirector. If you stop a timeline midway, any animation, signal emitter, or property track that hasn't finished won't trigger its end-state, leading to "ghost" objects or stuck game states. A robust skip system must ensure the timeline completes all required logic as if it had played to the very end.

Orchestrating the Skip

To ensure synchronization, we use the PlayableDirector.time property to manually jump the timeline to its duration. However, simply setting the time isn't enough because events triggered by SignalEmitters might be skipped entirely.

To solve this, we define a "Completion Method" that performs the same state-cleanup logic that your signals or final animation tracks would have triggered naturally.

public void SkipCutscene()
{
    if (timelineDirector.state == PlayState.Playing)
    {
        // 1. Jump to the very end of the timeline
        timelineDirector.time = timelineDirector.duration;
        
        // 2. Force the director to evaluate at the end position
        timelineDirector.Evaluate();

        // 3. Manually trigger necessary cleanup
        // This ensures game state (like opening a door) occurs
        FinalizeCutsceneState();
    }
}

Ensuring Synchronization

By calling Evaluate() immediately after setting the time, you force the PlayableDirector to calculate the final frame's poses and parameter changes. This is the "robust" part of your logic: it guarantees that objects are moved to their target transforms and UI elements are correctly enabled or disabled. If your Timeline relies on complex SignalEmitters for state changes, ensure those methods are accessible by your SkipCutscene logic so the game doesn't assume the cutscene is "still running" in the background. Always verify your final object positions in the Editor during a skip to ensure they match the intended end-frame of your sequence.

Key Takeaway: Robust skipping requires manually pushing your timeline to its duration and explicitly calling an evaluation to ensure all final state-logic is executed cleanly.