RealDocs

UAnimInstance::Montage_GetNextSectionID

function Engine Since 4.0
#include "Animation/AnimInstance.h"
Access: public Specifiers: ENGINE_API

Description

Returns the section index that will play after the specified section, respecting any per-instance section redirects set via Montage_SetNextSection.

Caveats & Gotchas

  • Returns INDEX_NONE (-1) if the current section has no successor — this means the montage will stop after the current section finishes rather than looping or continuing.
  • This reads the per-instance section redirect table, not the static montage asset data. The result can differ between two instances playing the same montage if one has had Montage_SetNextSection called on it.
  • Calling this on a montage that is not currently playing (no live FAnimMontageInstance) will return INDEX_NONE regardless of the montage's authored section links.

Signature

ENGINE_API int32 Montage_GetNextSectionID(UAnimMontage const* const Montage, int32 const& CurrentSectionID) const;

Parameters

Name Type Description Default
Montage UAnimMontage const* const The montage to query.
CurrentSectionID int32 const& The index of the current section within the montage.

Return Type

int32

Example

Preview the upcoming section to conditionally cancel a combo C++
int32 CurrentSection = AnimInstance->Montage_GetCurrentSection(AttackMontage);
int32 NextSection = AnimInstance->Montage_GetNextSectionID(AttackMontage, CurrentSection);
if (NextSection == INDEX_NONE)
{
    // Montage will stop — allow player to exit combo
    bCanInterruptCombo = true;
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.