RealDocs

UActorComponent::GetComponentChildElements

function Engine Since unknown
#include "Components/ActorComponent.h"
Access: public Specifiers: virtual

Description

Returns the logical child elements of this component for the Typed Elements hierarchy system. The base implementation is empty; override it in component subclasses that own typed element children.

Caveats & Gotchas

  • Part of the Typed Elements framework (UTypedElementHierarchyInterface). Only relevant if your component integrates with that system — most gameplay components never need to override this.
  • bAllowCreate=false is used in hot paths (e.g., editor selection queries) where constructing new handles would be too expensive; guard any handle creation behind that flag.

Signature

virtual void GetComponentChildElements(TArray<FTypedElementHandle>& OutElementHandles, const bool bAllowCreate = true)

Parameters

Name Type Description Default
OutElementHandles TArray<FTypedElementHandle>& Array to populate with typed element handles for this component's logical children.
bAllowCreate bool Whether element handles may be created on demand if they do not already exist. true

Return Type

void

Example

Exposing child typed element handles C++
void UMyComponent::GetComponentChildElements(TArray<FTypedElementHandle>& OutElementHandles, const bool bAllowCreate)
{
    Super::GetComponentChildElements(OutElementHandles, bAllowCreate);
    if (ChildHandle.IsSet())
    {
        OutElementHandles.Add(ChildHandle);
    }
    else if (bAllowCreate)
    {
        ChildHandle = CreateMyHandle();
        OutElementHandles.Add(ChildHandle);
    }
}

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.