UAnimInstance::AddExternalNotifyHandler
#include "Animation/AnimInstance.h"
Access: public
Description
Registers an external delegate handler for a named anim notify. Allows gameplay code outside the Animation Blueprint to receive callbacks when specific anim notifies fire, without requiring Blueprint or AnimNotify subclass implementation.
Caveats & Gotchas
- • The registered delegate persists until explicitly removed with RemoveExternalNotifyHandler or the anim instance is destroyed. Failing to remove handlers when the listening object is destroyed will cause dangling delegate crashes.
- • The notify name must exactly match the name used in the montage or animation sequence — it is case-sensitive. A mismatched name will silently fail to trigger.
Signature
void AddExternalNotifyHandler(FName NotifyName, FOnAnimNotifySignature::FDelegate NotifyDelegate) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| NotifyName | FName | The name of the anim notify to listen for. | — |
| NotifyDelegate | FOnAnimNotifySignature::FDelegate | The delegate to invoke when the named notify fires. | — |
Return Type
void Example
Register external notify handler from a character C++
void AMyCharacter::SetupAnimNotifyHandlers()
{
if (UAnimInstance* AnimInst = GetMesh()->GetAnimInstance())
{
FOnAnimNotifySignature::FDelegate NotifyDelegate;
NotifyDelegate.BindUObject(this, &AMyCharacter::OnFootstepNotify);
AnimInst->AddExternalNotifyHandler(FName("Footstep"), NotifyDelegate);
}
}
void AMyCharacter::OnFootstepNotify(FName NotifyName, const FBranchingPointNotifyPayload& Payload)
{
// Play footstep sound at character location
UGameplayStatics::PlaySoundAtLocation(this, FootstepSound, GetActorLocation());
} Tags
Version History
Introduced in: 4.11
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?