RealDocs

AActor::DestroyConstructedComponents

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

Description

Destroys all components that were created by the construction script (Blueprint or C++ OnConstruction), preparing the actor for a full re-run of its construction scripts.

Caveats & Gotchas

  • This only destroys components flagged as construction-script-created (bCreatedByConstructionScript). Components added in the class constructor (CreateDefaultSubobject) are not touched.
  • Called automatically before RerunConstructionScripts in the editor; calling it in game code without immediately re-running construction will leave the actor in a partially constructed state.

Signature

ENGINE_API void DestroyConstructedComponents();

Return Type

void

Example

Called automatically before RerunConstructionScripts C++
#if WITH_EDITOR
void AMyActor::RerunConstructionScripts()
{
    // Engine calls DestroyConstructedComponents here internally
    Super::RerunConstructionScripts();
    // Construction script re-creates components
}
#endif

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.