AActor::IsActorInitialized
#include "GameFramework/Actor.h"
Access: public
Specifiers: const
Description
Returns true after the actor has completed its initialization phase (PostInitializeComponents and PreInitializeComponents have completed). Does not imply BeginPlay has been called.
Caveats & Gotchas
- • Initialized does not mean gameplay has started. An actor can be initialized but not yet begun play — check HasActorBegunPlay() if you need to know whether BeginPlay has run.
- • Actor initialization happens before BeginPlay during both level load and dynamic spawn. Code that must run post-initialization but might be called before BeginPlay (e.g. from another actor's BeginPlay) can safely guard with this check.
Signature
bool IsActorInitialized() const { return bActorInitialized; } Return Type
bool Example
Guard against using an actor before it has initialized C++
void AMyManager::RegisterActor(AActor* Actor)
{
if (!Actor || !Actor->IsActorInitialized())
{
PendingRegistrations.Add(Actor);
return;
}
DoRegister(Actor);
} Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?