AActor::OnEndPlay
#include "GameFramework/Actor.h"
Access: public
Specifiers: UPROPERTYBlueprintAssignable
Description
Delegate broadcast whenever this actor's play session ends for any reason — explicit destruction, level unload, game end, or streaming out. More reliable than OnDestroyed for general cleanup.
Caveats & Gotchas
- • The EEndPlayReason::Type parameter tells you why EndPlay occurred. Check it to distinguish between destruction (Destroyed), level transition (LevelTransition), and application exit (Quit) if your cleanup logic differs.
- • OnEndPlay fires before OnDestroyed. If you bind to both, OnEndPlay will run first.
Signature
UPROPERTY(BlueprintAssignable, Category="Game")
FActorEndPlaySignature OnEndPlay Examples
Disable collision and hide this actor when its play session ends
Blueprint
Bind OnEndPlay to release a pooled resource C++
MyActor->OnEndPlay.AddDynamic(this, &AMySystem::HandleEndPlay);
void AMySystem::HandleEndPlay(AActor* Actor, EEndPlayReason::Type EndPlayReason)
{
ResourcePool.Release(Actor);
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?