UKismetSystemLibrary::GetActorListFromComponentList
#include "Kismet/KismetSystemLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintCallable
Description
Collects the unique owning actors of a list of primitive components, commonly used to turn overlap/hit component results into an actor list.
Caveats & Gotchas
- • Each actor appears at most once in OutActorList even if several of its components are present in ComponentList.
- • Passing null for ActorClassFilter includes all owning actor classes; there is no way to exclude a class rather than filter to one.
- • Components with a null Owner are silently skipped rather than causing an error.
Signature
static void GetActorListFromComponentList(const TArray<class UPrimitiveComponent*>& ComponentList, UClass* ActorClassFilter, TArray<class AActor*>& OutActorList) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| ComponentList | const TArray<UPrimitiveComponent*>& | Components whose owning actors should be collected. | — |
| ActorClassFilter | UClass* | If set, only owning actors of this class (or a subclass) are included. | — |
| OutActorList | TArray<AActor*>& | Receives the unique list of owning actors. | — |
Return Type
void Example
Collapse overlapping components to unique actors C++
TArray<UPrimitiveComponent*> OverlappingComponents;
CapsuleComponent->GetOverlappingComponents(OverlappingComponents);
TArray<AActor*> OverlappingActors;
UKismetSystemLibrary::GetActorListFromComponentList(OverlappingComponents, APawn::StaticClass(), OverlappingActors); Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?