RealDocs

AActor::InitializeComponents

function Engine Since 4.0
#include "GameFramework/Actor.h"
Access: public

Description

Iterates over all components and calls InitializeComponent on each one. This happens once per actor during the spawn sequence, before BeginPlay is dispatched.

Caveats & Gotchas

  • InitializeComponent on each UActorComponent is only called once in the component's lifetime — re-registering a component does not call it again.
  • If you add a component dynamically after the actor has already been initialized, you must call InitializeComponent on that specific component yourself; InitializeComponents will not retroactively cover it.

Signature

ENGINE_API void InitializeComponents();

Return Type

void

Example

Called automatically — shows where it fits in the spawn lifecycle C++
// Spawn order (engine-managed, shown for context):
// 1. PostInitializeComponents
// 2. InitializeComponents  <-- this function
// 3. BeginPlay

// In a component subclass:
void UMyComponent::InitializeComponent()
{
    Super::InitializeComponent();
    // One-time setup that requires the owner actor to exist
}

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.