UAnimInstance::Montage_SetNextSection
#include "Animation/AnimInstance.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallable
Description
Changes which section plays next after the specified section at runtime, overriding the static next-section link defined in the montage asset. Pass NAME_None as NextSection to end the montage after SectionNameToChange.
Caveats & Gotchas
- • This only affects the runtime instance of the montage — the asset itself is not modified, so the override applies only to the currently playing instance.
- • Setting NextSection to the same value as SectionNameToChange creates an infinite loop; the montage will never reach its natural end unless explicitly stopped or the link is changed again.
Signature
ENGINE_API void Montage_SetNextSection(FName SectionNameToChange, FName NextSection, const UAnimMontage* Montage = NULL); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| SectionNameToChange | FName | The section whose successor link should be changed. | — |
| NextSection | FName | The section that will play after SectionNameToChange finishes. Pass NAME_None to make the montage stop after that section. | — |
| Montage | const UAnimMontage* | The montage on which to change the section link. NULL applies to all active montages. | NULL |
Return Type
void Example
Dynamically route a combo montage based on input C++
// After the Light attack section, chain into Heavy if the button was pressed
FName NextSec = bHeavyPressed ? FName("HeavyAttack") : FName("RecoveryIdle");
AnimInstance->Montage_SetNextSection(FName("LightAttack"), NextSec, ComboMontage); Tags
Version History
Introduced in: 4.5
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?