RealDocs

UActorComponent::IsOwnerRunningUserConstructionScript

function Engine Since 4.0
#include "Components/ActorComponent.h"
Access: public

Description

Returns true while the owning actor is executing its Blueprint User Construction Script (UCS). Use this to skip expensive or unsafe operations that should not run during actor construction.

Caveats & Gotchas

  • This returns true during the UCS phase in the editor as well as during cook-time construction — any code guarded by this check is also suppressed during those editor passes.
  • Components that cache state during initialization must handle the case where this returns true and the state has not yet been set up — the UCS may run multiple times (e.g. when a Blueprint property is changed in the editor).

Signature

ENGINE_API bool IsOwnerRunningUserConstructionScript() const;

Return Type

bool

Example

Skip expensive work during construction script C++
void UMyComponent::OnSomethingChanged()
{
    if (IsOwnerRunningUserConstructionScript())
    {
        // Defer — values are not final yet during UCS
        return;
    }
    RebuildInternalCache();
}

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.