AActor::PreInitializeComponents
#include "GameFramework/Actor.h"
Access: public
Specifiers: virtual
Description
Called immediately before InitializeComponent() is invoked on each of the actor's components, and only during gameplay (not in the editor). Use it for actor-level setup that must happen before components initialise.
Caveats & Gotchas
- • Only called during gameplay — not during editor construction or preview. Use OnConstruction() for setup that should also run in the editor.
- • When overriding, call Super::PreInitializeComponents() to allow parent classes to run their initialisation. Skipping the Super call can prevent engine subsystems from properly setting up actors (e.g., the replication state machine).
Signature
ENGINE_API virtual void PreInitializeComponents(); Return Type
void Example
Override to configure actor state before component init C++
void AMyActor::PreInitializeComponents()
{
Super::PreInitializeComponents();
// Set data that components read during their own InitializeComponent
CurrentTeam = DetermineTeamFromGameMode();
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?