RealDocs

AActor::RegisterAllComponents

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

Description

Registers all components that belong to this actor with the world. Called by the engine during spawning; may also be called explicitly after manually adding components at runtime.

Caveats & Gotchas

  • When Blueprint SCS execution is pending (deferred spawn), this call is delayed until the SCS has run, causing HasDeferredComponentRegistration() to return true in the interim. Accessing components before this completes may yield null or unregistered components.
  • Overrides must call Super::RegisterAllComponents() and then SetHasActorRegisteredAllComponents() before calling PostRegisterAllComponents(). Violating this ordering breaks the registration state machine used by lighting and collision.

Signature

ENGINE_API virtual void RegisterAllComponents();

Return Type

void

Example

Forcing re-registration after adding a runtime component C++
UMyComponent* NewComp = NewObject<UMyComponent>(this);
NewComp->RegisterComponent(); // preferred for a single component
// Or to force the entire actor to re-register:
// UnregisterAllComponents();
// RegisterAllComponents();

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.