AActor::PostActorConstruction
#include "GameFramework/Actor.h"
Access: public
Specifiers: ENGINE_API
Description
Called after the actor has run its construction script. Responsible for finishing the actor spawn process, including calling PostInitializeComponents and BeginPlay if the world has already started.
Caveats & Gotchas
- • This is an engine-internal method called automatically after FinishSpawning; do not call it manually — doing so can result in double-initialization of components and double BeginPlay calls.
- • In deferred spawn workflows (SpawnActorDeferred), FinishSpawning() eventually calls this — any property setup you do before FinishSpawning is complete before PostActorConstruction runs.
- • The function will call BeginPlay immediately if the world is already in play; if the world hasn't started yet, BeginPlay is deferred until the world begins.
Signature
ENGINE_API void PostActorConstruction() Return Type
void Example
Deferred spawn pattern that leads into PostActorConstruction C++
AMyActor* Actor = GetWorld()->SpawnActorDeferred<AMyActor>(AMyActor::StaticClass(), SpawnTransform);
if (Actor)
{
Actor->MyProperty = 42; // Set properties before PostActorConstruction runs
Actor->FinishSpawning(SpawnTransform); // Internally calls PostActorConstruction
} Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?