UAnimInstance::GetActiveMontageInstance
#include "Animation/AnimInstance.h"
Access: public
Specifiers: ENGINE_API
Description
Returns the currently active (topmost weight-contributing) montage instance, or nullptr if no montage is playing. This is the fast path for single-montage use cases where you only need the dominant montage.
Caveats & Gotchas
- • Returns only the single topmost instance. If multiple montages are layered simultaneously, the others are not returned. Use GetActiveInstanceForMontage to target a specific asset.
- • Do not cache the returned pointer across frames. The FAnimMontageInstance is destroyed as soon as the montage ends, leaving you with a dangling pointer if you hold it.
Signature
ENGINE_API FAnimMontageInstance* GetActiveMontageInstance() const; Return Type
FAnimMontageInstance* Example
Check the current position of the active montage C++
if (FAnimMontageInstance* ActiveInstance = AnimInstance->GetActiveMontageInstance())
{
float CurrentPosition = ActiveInstance->GetPosition();
UE_LOG(LogTemp, Log, TEXT("Montage position: %f"), CurrentPosition);
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?