AActor::OnDestroyed
#include "GameFramework/Actor.h"
Access: public
Specifiers: UPROPERTYBlueprintAssignable
Description
Delegate broadcast when this actor has been explicitly destroyed via Destroy(). Use it to notify other systems or clean up references without subclassing.
Caveats & Gotchas
- • Only fires when Destroy() is called explicitly. It does not fire when an actor is removed during level unload or streaming — use OnEndPlay for a more comprehensive teardown signal.
- • By the time bound handlers execute, the actor is already marked as being destroyed. Do not call methods that spawn new actors referencing this actor as an owner within the handler, as the owner may be invalid.
Signature
UPROPERTY(BlueprintAssignable, Category="Game")
FActorDestroyedSignature OnDestroyed Examples
Print the destroyed actor's name when this actor is destroyed
Blueprint
Listen for actor destruction to remove it from a manager list C++
// In the manager
MyActor->OnDestroyed.AddDynamic(this, &AMyManager::HandleActorDestroyed);
void AMyManager::HandleActorDestroyed(AActor* DestroyedActor)
{
ManagedActors.Remove(DestroyedActor);
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?