RealDocs

UAnimInstance::GetActiveInstanceForMontage

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

Description

Returns the active FAnimMontageInstance for a specific UAnimMontage asset, or nullptr if that montage is not currently playing. Prefer this over GetActiveMontageInstance when multiple montages may be active simultaneously.

Caveats & Gotchas

  • If the same montage asset is playing in multiple slots simultaneously, this returns only one instance — typically the most recently started one. There is no API guarantee about which instance is returned in the multi-instance case.
  • Returns nullptr if the montage is in its blend-out phase but still has weight — check GetInstanceForMontage if you need to include blending-out instances.

Signature

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

Parameters

Name Type Description Default
Montage const UAnimMontage& The montage asset to look up.

Return Type

FAnimMontageInstance*

Example

Get position of a specific montage while others are also playing C++
if (FAnimMontageInstance* Instance = AnimInstance->GetActiveInstanceForMontage(*ReloadMontage))
{
    float Progress = Instance->GetPosition() / ReloadMontage->GetPlayLength();
    ReloadProgressBar->SetPercent(Progress);
}

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.