UAnimInstance::RemoveExternalNotifyHandler
#include "Animation/AnimInstance.h"
Access: public
Description
Removes a previously registered external delegate handler for a named anim notify. Call this during cleanup (e.g., EndPlay or BeginDestroy) to prevent dangling delegate references when the listening object is destroyed.
Caveats & Gotchas
- • You must pass the same delegate instance that was used in AddExternalNotifyHandler. Creating a new delegate bound to the same function will not match — store the original delegate if you need to remove it later.
- • If the anim instance has already been destroyed (e.g., the skeletal mesh component was removed), calling this is unnecessary but safe — the handlers are cleared automatically on anim instance destruction.
Signature
void RemoveExternalNotifyHandler(FName NotifyName, FOnAnimNotifySignature::FDelegate NotifyDelegate) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| NotifyName | FName | The name of the anim notify to stop listening for. | — |
| NotifyDelegate | FOnAnimNotifySignature::FDelegate | The delegate to remove from the notify handler list. | — |
Return Type
void Example
Clean up notify handler on EndPlay C++
void AMyCharacter::EndPlay(const EEndPlayReason::Type EndPlayReason)
{
if (UAnimInstance* AnimInst = GetMesh()->GetAnimInstance())
{
AnimInst->RemoveExternalNotifyHandler(FName("Footstep"), FootstepNotifyDelegate);
}
Super::EndPlay(EndPlayReason);
} Tags
Version History
Introduced in: 4.11
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?