In this lesson, you will learn how to synchronize specific character state changes with your cinematic sequences by driving Animator parameters directly through Unity Timeline.
Bridging Timeline and Animation Controllers
In previous lessons, we used Timeline to animate object transforms and orchestrate camera movements. However, for complex character actions—like switching from an "Idle" state to a "Cheer" or "Wave" animation—we rely on the Animator Controller’s State Machine. Instead of keyframing every bone manually, we can use the Animation Track in Timeline to flip the internal switches of your Animator.
Setting Up the Animation Track
To control your character's state, follow these steps:
- Add an Animation Track: In your Timeline window, right-click and add an
Animation Track. Drag your character object (the one with theAnimatorcomponent) into the track binding slot. - Record Parameters: Click the Record button (the red circle icon) on the Animation Track header.
- Drive the Parameters: Navigate to your character’s
Animatorwindow or the Inspector while the Timeline playhead is positioned at your desired moment. If you have an existing Parameter (like aboolnamedisDancingor anintnamedmoodIndex), toggle it or change its value. - Keyframes: Unity will automatically create a keyframe for that specific parameter at the playhead’s position.
When the Timeline plays back, it will treat these parameters as animated properties. If your character’s Animator Controller has a transition set up to trigger when isDancing becomes true, Timeline will force that transition to fire exactly when your keyframe hits.
Pro-Tip for Transitions
If you want a character to enter a specific state and stay there, ensure your Animator transitions do not have "Has Exit Time" checked if you want an immediate snap, or keep it checked if you want the character to finish their current cycle before switching. This technique is perfect for "scripted narrative moments" where you need a character to react to the camera movement or dialogue perfectly in sync with the scene.
Key Takeaway: By using the Record feature on an Animation Track, you can manipulate Animator parameters as timeline-synced keyframes, allowing your character’s logic to respond precisely to the rhythm of your cutscene.