Unreal Engine 5 · Blueprint → C++
Set (TSet) in Unreal Engine 5 C++UE Docs
The Blueprint Set maps to TSet in Unreal Engine 5 C++, a container of unique values. Use TSet::Add to insert and TSet::Contains for fast membership lookups.
Blueprint node & C++ equivalent
TSet<int32> Unique;
Unique.Add(5);
bool bHas = Unique.Contains(5);What does the Set container do?
A Set stores unique elements with no duplicates and offers fast checks for whether a value is present. In Unreal Engine 5 C++ this is the TSet container, declared here as TSet<int32>.
The C++ equivalent
Unique.Add(5) inserts the value 5; adding a value that already exists is a no-op, keeping the set distinct. Unique.Contains(5) returns a bool and runs in near-constant time because TSet is hash-based, unlike TArray::Contains which scans linearly.
When to use TSet over TArray
Choose TSet when you need uniqueness and frequent membership tests, such as tracking which actors have been processed. Note that TSet does not preserve insertion order and is not directly indexable like an array. If you need ordering or indexing, stick with TArray.
Frequently asked questions
How do you use a TSet in UE5 C++?+
Declare TSet<Type>, add values with Add(Value), and test membership with Contains(Value). Duplicate adds are ignored automatically.
What is the difference between TSet and TArray in UE5?+
TSet stores unique, unordered values with fast hash-based lookup, while TArray keeps ordered, indexable elements and searches linearly with Contains.