RealDocs

UAnimInstance::GetInstanceForMontage

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

Description

Returns the FAnimMontageInstance for a given montage regardless of whether it is actively playing or in its blend-out phase. Broader than GetActiveInstanceForMontage, which skips blending-out instances.

Caveats & Gotchas

  • Includes instances that are blending out — the montage may be nearly invisible at near-zero weight. Check FAnimMontageInstance::IsActive() if you need to distinguish active from blending-out.
  • Like GetActiveInstanceForMontage, returns only one instance when the same asset is playing in multiple concurrent instances. The selection is not deterministic beyond engine internals.

Signature

ENGINE_API FAnimMontageInstance* GetInstanceForMontage(const UAnimMontage& Montage) const;

Parameters

Name Type Description Default
Montage const UAnimMontage& The montage asset to search for.

Return Type

FAnimMontageInstance*

Example

Query a montage even while it is blending out C++
FAnimMontageInstance* Instance = AnimInstance->GetInstanceForMontage(*AttackMontage);
if (Instance)
{
    UE_LOG(LogTemp, Log, TEXT("Montage weight: %f, IsActive: %d"),
        Instance->GetWeight(), (int32)Instance->IsActive());
}

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.