AActor::PostActorCreated
#include "GameFramework/Actor.h"
Access: public
Specifiers: virtualENGINE_API
Description
Called after an actor is spawned into the world (via UWorld::SpawnActor), both in the editor and during gameplay. Native components have been created and the location/rotation are set, but construction scripts have not yet run.
Caveats & Gotchas
- • PostActorCreated runs before construction scripts (BuildingComponents, user construction script). Do not rely on Blueprint construction script output being available here.
- • Unlike BeginPlay, this fires in the editor when an actor is placed or duplicated — guard editor-only logic carefully if you override this function.
- • Always call Super::PostActorCreated() to ensure the engine can complete its own initialization.
Signature
ENGINE_API virtual void PostActorCreated(); Return Type
void Example
Performing post-spawn C++ initialization C++
void AMyActor::PostActorCreated()
{
Super::PostActorCreated();
// Native components exist here, so we can configure them
if (MeshComponent)
{
MeshComponent->SetCastShadow(bShouldCastShadow);
}
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?