UAnimInstance::Montage_GetEndedDelegate
#include "Animation/AnimInstance.h"
Access: public
Specifiers: ENGINE_API
Description
Returns a pointer to the FOnMontageEnded delegate for the specified montage instance, allowing callers to inspect or directly bind to it after the fact.
Caveats & Gotchas
- • Returns nullptr if no matching montage instance is found (e.g., the montage isn't playing or has already ended). Always null-check before dereferencing.
- • The returned pointer is valid only for the lifetime of the FAnimMontageInstance — do not cache it across frames as the instance may be freed once the montage completes.
Signature
ENGINE_API FOnMontageEnded* Montage_GetEndedDelegate(UAnimMontage* Montage = nullptr); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Montage | UAnimMontage* | The montage whose ended delegate to retrieve. Passing nullptr returns the delegate for the topmost active montage instance. | nullptr |
Return Type
FOnMontageEnded* Example
Conditionally add a binding if one isn't already set C++
FOnMontageEnded* EndDelegate = AnimInstance->Montage_GetEndedDelegate(ReloadMontage);
if (EndDelegate && !EndDelegate->IsBound())
{
EndDelegate->BindUObject(this, &AMyCharacter::OnReloadFinished);
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?