Course contentsShow
← Unreal Engine Game Development
Lesson 330 of 8805. Animation and Character RiggingFree lesson

Utilizing Animation Montages for Interruptible Actions

You will implement animation montages to trigger one-shot character actions that override existing state machine logic without breaking the base locomotion flow.

In this lesson, you will learn how to trigger one-shot actions like melee attacks or interact animations that override your main movement states without breaking your base locomotion flow.

The Problem with State Machines

Up until now, you have relied on State Machines to govern your character’s behavior. While great for continuous cycles like "Run" or "Idle," State Machines become cumbersome when you need to fire off a quick action—like a sword swing—because you would have to add transitions to and from every single state in your graph.

Enter Animation Montages

An Animation Montage acts as a dynamic override. It is a separate container that sits "on top" of your AnimGraph. When you play a Montage, Unreal Engine temporarily ignores the current State Machine output for a specific bone structure (or the whole body) to play your custom animation, then seamlessly returns control to the State Machine once finished.

Implementation in the AnimGraph

To make this work, you must add the Slot node to your AnimGraph. Think of the Slot as a "window" that the Montage plays through.

  1. Create a Slot: In your Animation Blueprint, open the AnimGraph.
  2. Add the Slot Node: Search for DefaultSlot (or create a custom one) and place it between your State Machine and the Output Pose node.
  3. Trigger the Montage: In your Character Blueprint, use the Play Anim Montage node.
// Logic inside your Character Blueprint
if (bCanAttack) {
    PlayAnimMontage(AttackMontage, 1.0f, NAME_None);
}

Because the Montage is playing on a Slot node, it will override the State Machine animation, but as soon as the Montage ends or is interrupted (e.g., by another Montage or a hit reaction), the character gracefully snaps back to the state determined by your Locomotion State Machine. This allows you to keep your locomotion logic clean and focused on movement, while keeping your combat or interaction actions modular and easy to fire at any time.

Key Takeaway: Animation Montages allow you to inject temporary, one-shot animations into your character without cluttering your State Machine with complex, redundant transition rules.