RealDocs

AActor::Destroyed

function Engine Since 4.0
#include "GameFramework/Actor.h"
Access: public Specifiers: virtual

Description

Called when this actor is explicitly destroyed during gameplay or in the editor. Not called during level streaming unloads or when the game ends.

Caveats & Gotchas

  • This is NOT called during level transitions, when the world ends, or when actors are removed due to level streaming. Use EndPlay for guaranteed cleanup — Destroyed is only fired for explicit Destroy() calls.
  • At the time Destroyed fires the actor is still valid and all components are accessible, but it is flagged as pending kill. Avoid starting any async operations here; they may outlive the actor.

Signature

virtual void Destroyed()

Return Type

void

Example

Clean up references when explicitly destroyed C++
void AMyActor::Destroyed()
{
    Super::Destroyed();
    // Notify a manager that this actor is gone
    if (AMyGameMode* GM = Cast<AMyGameMode>(GetWorld()->GetAuthGameMode()))
    {
        GM->OnActorDestroyed(this);
    }
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.