AActor::GetComponents

Get all components derived from specified ComponentClass and fill in the OutComponents array with the result.

Windows
MacOS
Linux

References

Module

Engine

Header

/Engine/Source/Runtime/Engine/Classes/GameFramework/Actor.h

Include

#include "GameFramework/Actor.h"

Syntax

template<class AllocatorType>
void GetComponents
(
    TSubclassOf< UActorComponent > ComponentClass,
    TArray< UActorComponent *, AllocatorType > & OutComponents,
    bool bIncludeFromChildActors
) const

Remarks

Get all components derived from specified ComponentClass and fill in the OutComponents array with the result. It's recommended to use TArrays with a TInlineAllocator to potentially avoid memory allocation costs. TInlineComponentArray is defined to make this easier, for example: { TInlineComponentArray PrimComponents(Actor); }

Parameters

Parameter

Description

ComponentClass

The component class to find all components of a class derived from

bIncludeFromChildActors

If true then recurse in to ChildActor components and find components of the appropriate type in those Actors as well

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss