AActor::DestroyNetworkActorHandled
#include "GameFramework/Actor.h"
Access: public
Specifiers: virtualENGINE_API
Description
Called by DestroyActor() to give actors a chance to opt out of immediate destruction, allowing the network layer to perform cleanup first. Returns true to halt actor destruction.
Caveats & Gotchas
- • Returning true from this function means DestroyActor() will not proceed with the normal destruction sequence — you are taking full responsibility for eventually destroying the actor.
- • The default implementation returns false, so destruction proceeds normally. The engine uses this in network code (e.g. BeaconClient, NetConnection cleanup) to delay until the connection teardown is complete.
- • If you override this and return true without later destroying the actor, you will create a persistent zombie actor that sits in the world indefinitely.
Signature
ENGINE_API virtual bool DestroyNetworkActorHandled() Return Type
bool Example
Delay destruction until network cleanup completes C++
bool AMyNetActor::DestroyNetworkActorHandled()
{
if (bNetworkCleanupPending)
{
// Tell the engine not to destroy yet; we'll call Destroy() ourselves later
return true;
}
return Super::DestroyNetworkActorHandled();
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?