UBlueprintSetLibrary::Set_GetItemByIndex
#include "Kismet/BlueprintSetLibrary.h"
Access: public
Specifiers: staticBlueprintPureCustomThunk
Description
Returns a copy of the set element stored at Index, for manually iterating a set by index.
Caveats & Gotchas
- • Iteration order in a TSet is implementation-defined and can shift whenever the set is mutated (any Add or Remove), so don't assume Index tracks insertion order or stays stable across edits.
- • Index must be within [0, Set_GetLastIndex] — this function does no bounds checking, so an out-of-range Index reads invalid memory. A ForEachLoop node is a safer default for iterating a set.
Signature
static void Set_GetItemByIndex(const TSet<int32>& TargetSet, int32 Index, int32& Item); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| TargetSet | const TSet<int32>& | Wildcard placeholder for the set to read from. | — |
| Index | int32 | Index into the set's internal storage. See Set_GetLastIndex for the valid range. | — |
| Item | int32& | Wildcard output that receives a copy of the element at Index. | — |
Return Type
void Example
Manual index iteration C++
TSet<int32> Values = {10, 20, 30};
for (auto It = Values.CreateConstIterator(); It; ++It)
{
int32 Item = *It; // native iteration -- the direct equivalent of manually walking Set_GetItemByIndex
} Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?