AActor::PostInitializeComponents
#include "GameFramework/Actor.h"
Access: public
Specifiers: virtualENGINE_API
Description
Called after all components have been initialized during gameplay or editor previews. Use this for setup that requires components to be fully initialized but must happen before BeginPlay.
Caveats & Gotchas
- • Always call Super::PostInitializeComponents() — skipping it will leave the actor's bActorInitialized flag false, which causes BeginPlay to be skipped entirely.
- • PostInitializeComponents is called during gameplay and some editor preview contexts, but not in the full editor when actors are placed in the level. Do not assume it fires in every editor scenario.
- • This is called before BeginPlay but after the constructor and component setup. Do not attempt to query game state (game mode, game instance) here as it may not be fully ready on all platforms.
Signature
ENGINE_API virtual void PostInitializeComponents(); Return Type
void Example
Cross-component initialization after all components are ready C++
void AMyActor::PostInitializeComponents()
{
Super::PostInitializeComponents(); // Required
// Safe to query component state here — all components are initialized
if (MeshComponent && PhysicsConstraint)
{
PhysicsConstraint->SetConstrainedComponents(
MeshComponent, NAME_None, nullptr, NAME_None);
}
} Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?