AActor::K2_DestroyActor
#include "GameFramework/Actor.h"
Access: public
Specifiers: virtualUFUNCTIONBlueprintCallableENGINE_API
Description
Destroys this actor at the end of the current frame, releasing it from the world. This is the Blueprint-facing wrapper for `AActor::Destroy()` — in C++ prefer calling `Destroy()` directly.
Caveats & Gotchas
- • Destruction is deferred — the actor remains valid for the rest of the current frame and any code continuing after this call. Do not assume the actor's components are gone immediately.
- • In C++ there is almost never a reason to call `K2_DestroyActor()` — use `Destroy()` instead. The K2 prefix is a UHT convention marking Blueprint-exposed virtual overrides of C++ functions.
- • Has no effect on actors that are not owned by the local authority (i.e., replicated actors on clients). Destruction must be initiated on the server.
Signature
ENGINE_API virtual void K2_DestroyActor(); Return Type
void Examples
Destroy self when the player character overlaps this actor
Blueprint
Destroy actor after a delay via Blueprint-equivalent C++ call C++
// Prefer Destroy() in C++:
void AMyPickup::OnPickedUp()
{
// Correctly marks actor for destruction
Destroy();
// K2_DestroyActor() is equivalent and also works,
// but is the Blueprint-native entry point:
// K2_DestroyActor();
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?