RealDocs

AActor::ExecuteConstruction

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

Description

Runs the actor's construction scripts, including OnConstruction and the Blueprint Construction Script. Returns false if the hierarchy was error-free; if it returns true the actor may be in disaster-recovery mode.

Caveats & Gotchas

  • A return value of false does NOT mean failure — the engine's convention here is inverted; false means success (no errors). True means the actor hierarchy had problems and disaster recovery was triggered.
  • Components created inside the Blueprint Construction Script are destroyed and recreated every time ExecuteConstruction runs; do not hold raw pointers to them across construction script invocations.

Signature

ENGINE_API bool ExecuteConstruction(const FTransform& Transform, const struct FRotationConversionCache* TransformRotationCache, const class FComponentInstanceDataCache* InstanceDataCache, bool bIsDefaultTransform = false, ESpawnActorScaleMethod TransformScaleMethod = ESpawnActorScaleMethod::OverrideRootScale)

Parameters

Name Type Description Default
Transform const FTransform& The transform to construct the actor at.
TransformRotationCache const struct FRotationConversionCache* Optional cache to avoid redundant rotation conversions.
InstanceDataCache const class FComponentInstanceDataCache* Optional cache of component instance state to restore after construction.
bIsDefaultTransform bool Whether the transform is a default that can be overridden by template values. false
TransformScaleMethod ESpawnActorScaleMethod How scale from the transform should interact with root component scale. ESpawnActorScaleMethod::OverrideRootScale

Return Type

bool

Example

Manually re-run construction after property change (editor utility) C++
#if WITH_EDITOR
void AMyActor::PostEditChangeProperty(FPropertyChangedEvent& Event)
{
    Super::PostEditChangeProperty(Event);
    ExecuteConstruction(GetActorTransform(), nullptr, nullptr, false);
}
#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.