AActor::GetAutoDestroyWhenFinished
#include "GameFramework/Actor.h"
Access: public
Specifiers: inline
Description
Returns whether this actor will automatically destroy itself when all its relevant components report that they are finished and no timelines or timers are in flight.
Caveats & Gotchas
- • The underlying bAutoDestroyWhenFinished flag is only checked by the engine for actors like AMatineeActor and audio actors — custom actor classes must implement their own 'finished' detection and call Destroy() themselves; setting this flag alone does nothing for arbitrary actor subclasses.
- • This is a private field exposed via a getter, so it cannot be set via C++ assignment — use SetAutoDestroyWhenFinished() to change it.
Signature
bool GetAutoDestroyWhenFinished() const { return bAutoDestroyWhenFinished; } Return Type
bool Example
Check auto-destroy state before spawning a duplicate C++
if (!ExistingActor->GetAutoDestroyWhenFinished())
{
// Actor won't clean itself up — track it manually
TrackedActors.Add(ExistingActor);
} See Also
Tags
Version History
Introduced in: 4.8
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?