UAnimInstance::Montage_GetCurrentSection
#include "Animation/AnimInstance.h"
Access: public
Specifiers: ENGINE_APIconstBlueprintPureUFUNCTION
Description
Returns the name of the section currently playing in the specified montage. Useful for branching logic based on which section of an attack or ability animation is active.
Caveats & Gotchas
- • Returns NAME_None if the montage is not active or if no montage is playing when NULL is passed. Always validate the returned name before using it in comparisons.
- • When sections loop (via Montage_SetNextSection), this reflects the currently executing section, not the one that was originally queued — the result can differ from what you set up at montage start.
Signature
ENGINE_API FName Montage_GetCurrentSection(const UAnimMontage* Montage = NULL) const; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Montage | const UAnimMontage* | The montage to query. If NULL, queries the first active montage found. | NULL |
Return Type
FName Example
Detect current combo section C++
FName CurrentSection = Montage_GetCurrentSection(ComboMontage);
if (CurrentSection == FName("Attack1") && bComboInputBuffered)
{
Montage_SetNextSection(FName("Attack1"), FName("Attack2"), ComboMontage);
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?