RealDocs

AActor::HasActorRegisteredAllComponents

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

Description

Returns whether this actor has fully registered all of its components — i.e., PostRegisterAllComponents() has been called and PostUnregisterAllComponents() has not yet been called.

Caveats & Gotchas

  • Returns false during PostLoad even if components are technically created; the flag is only set true immediately before PostRegisterAllComponents() runs.
  • Do not confuse with HasValidRootComponent(). An actor can have a valid root component but still return false here if component registration is still pending (e.g., Blueprint SCS deferred spawn).

Signature

bool HasActorRegisteredAllComponents() const { return bHasRegisteredAllComponents; }

Return Type

bool

Example

Guard against premature component access C++
void AMyActor::SomeFunction()
{
    if (!HasActorRegisteredAllComponents())
    {
        return; // Components not ready yet
    }
    UMyComponent* Comp = FindComponentByClass<UMyComponent>();
    // safe to use Comp here
}

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.