RealDocs

UAnimInstance::OnMontageSectionChanged

property Engine Blueprint Since 4.9
#include "Animation/AnimInstance.h"
Access: public Specifiers: UPROPERTYBlueprintAssignable

Description

Delegate broadcast whenever a montage moves to a new section, either by natural playback progression or via Montage_SetNextSection or Montage_JumpToSection. Use this to synchronise gameplay state to specific montage sections.

Caveats & Gotchas

  • Fires for every section transition, including programmatic ones triggered by Montage_JumpToSection. If your logic should only respond to natural progression, compare the new section name against the expected sequence rather than reacting to every invocation.
  • The delegate passes the montage and the new section name, but not the previous section name. If you need to track transitions from a specific section, store the previous section name in a member variable between calls.

Signature

UPROPERTY(BlueprintAssignable)
FOnMontageSectionChanged OnMontageSectionChanged;

Example

Play a sound when entering a specific montage section C++
AnimInstance->OnMontageSectionChanged.AddDynamic(this, &AMyCharacter::OnMontageSectionChanged);

void AMyCharacter::OnMontageSectionChanged(UAnimMontage* Montage, int32 PrevSectionIndex, int32 NextSectionIndex)
{
    if (Montage == ComboMontage)
    {
        // React to each combo section transition
        PlayComboHitSound(NextSectionIndex);
    }
}

Version History

Introduced in: 4.9

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.