RealDocs

AActor::UnregisterAllComponents

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

Description

Unregisters all currently registered components from the world. Typically called before destroying an actor or during reregistration to detach components from the rendering and physics systems.

Caveats & Gotchas

  • When called with bForReregister=true the engine skips certain costly teardown steps, so never use that flag unless you are about to immediately call ReregisterAllComponents.
  • Calling this outside of a reregister cycle (e.g. in game code) is almost never correct; prefer modifying individual components unless you specifically need to detach everything at once.

Signature

ENGINE_API virtual void UnregisterAllComponents(bool bForReregister = false);

Parameters

Name Type Description Default
bForReregister bool If true, RegisterAllComponents will be called immediately after, allowing some expensive operations to be skipped. false

Return Type

void

Example

Manual reregister cycle C++
// Temporarily unregister, make structural changes, then reregister
MyActor->UnregisterAllComponents(/*bForReregister=*/true);
// ... modify component structure ...
MyActor->ReregisterAllComponents();

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.