UAnimInstance::OnMontageInstanceStopped
#include "Animation/AnimInstance.h"
Access: public
Specifiers: ENGINE_APIvirtual
Description
Engine callback invoked immediately before a FAnimMontageInstance is destroyed, whether the montage finished naturally or was stopped manually. Override in subclasses to react to any montage stopping without needing per-montage delegate setup.
Caveats & Gotchas
- • The FAnimMontageInstance reference is still valid during this call, but you must not store the reference — the instance is freed after this function returns.
- • This is a low-level engine hook, not a Blueprint event. Gameplay code should generally prefer per-montage delegates (Montage_SetEndDelegate) which provide the same information with less coupling.
- • Calling Montage_Play inside this callback can cause re-entrant issues because the montage array is being modified. Defer new play calls via a timer or next-tick delegate if you need to chain montages.
Signature
ENGINE_API virtual void OnMontageInstanceStopped(FAnimMontageInstance& StoppedMontageInstance); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| StoppedMontageInstance | FAnimMontageInstance& | Reference to the montage instance that has just stopped. Valid during this call but will be destroyed shortly after. | — |
Return Type
void Example
Override to broadcast a game-level event whenever any montage stops C++
void UMyAnimInstance::OnMontageInstanceStopped(FAnimMontageInstance& StoppedMontageInstance)
{
Super::OnMontageInstanceStopped(StoppedMontageInstance);
// Notify the owning character's ability system
if (AMyCharacter* Owner = Cast<AMyCharacter>(GetOwningActor()))
{
Owner->OnAnyMontageStopped(StoppedMontageInstance.Montage);
}
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?