RealDocs

AActor::IsRunningUserConstructionScript

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

Description

Returns true while the Blueprint User Construction Script (UCS) is executing on this actor. Use this guard when C++ code can be called both from UCS and from gameplay to avoid side effects at construction time.

Caveats & Gotchas

  • The UCS runs in the editor each time a property is changed and again at PIE start — code that modifies world state (spawning actors, playing sounds) must be guarded with this check or skipped via !HasActorBegunPlay().
  • This flag is also true during the CDO construction path in some engine versions, so do not assume it implies a placed actor — always pair the check with a world-context guard if you need to distinguish editor from runtime.

Signature

inline bool IsRunningUserConstructionScript() const { return bRunningUserConstructionScript; }

Return Type

bool

Example

Skip world-state side effects during construction script C++
void AMyActor::OnConstruction(const FTransform& Transform)
{
    Super::OnConstruction(Transform);
    if (!IsRunningUserConstructionScript())
    {
        // Safe to spawn effects or modify other actors here
        SpawnDecalAtLocation(GetActorLocation());
    }
}

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.