UActorComponent::ComponentTags
#include "Components/ActorComponent.h"
Access: public
Specifiers: UPROPERTYEditAnywhereBlueprintReadWrite
Description
An array of FName tags associated with this component. Useful for grouping, querying, and categorizing components at runtime without subclassing.
Caveats & Gotchas
- • Component tags are separate from actor tags (AActor::Tags). GetComponentsByTag() searches ComponentTags, while GetComponentsByClass does not. Use the right query for your data.
- • Tags are stored as FName, which is case-insensitive for comparisons but case-preserving in display. Avoid adding large numbers of tags per component — linear search cost scales with tag count.
Signature
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category=Tags)
TArray<FName> ComponentTags Example
Querying components by tag C++
// Add a tag to a component at construction
MyComponent->ComponentTags.Add(FName("Interactable"));
// Later, find all components with that tag on an actor
TArray<UActorComponent*> Found = MyActor->GetComponentsByTag(UActorComponent::StaticClass(), FName("Interactable"));
for (UActorComponent* Comp : Found)
{
// Process each tagged component
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?