RealDocs

AActor::UserConstructionScript

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

Description

The Blueprint Construction Script entry point, called each time the actor is placed or modified in the editor and when it is spawned at runtime. Implement this in Blueprint to set up components and properties based on exposed variables.

Caveats & Gotchas

  • BlueprintInternalUseOnly = true means this function should never be called directly from C++; use ProcessUserConstructionScript() internally if you need to trigger it. Calling it directly bypasses component registration safety guards.
  • The construction script re-runs every time an exposed variable is changed in the editor Details panel, so any side effects (spawning actors, writing to persistent state) will run repeatedly and cause duplication or corruption.

Signature

UFUNCTION(BlueprintImplementableEvent, meta=(BlueprintInternalUseOnly = "true", DisplayName = "Construction Script"))
ENGINE_API void UserConstructionScript();

Return Type

void

Example

Typical Blueprint Construction Script use C++
// In C++ subclass: expose a variable and act on it in a Blueprint CS override
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category="Config")
float TowerHeight = 100.0f;

// Then in Blueprint's Construction Script:
// Set Relative Location of MeshComponent using TowerHeight

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.