RealDocs

UBlueprintMapLibrary::Map_GetKeyValueByIndex

function Engine Blueprint Since unknown
#include "Kismet/BlueprintMapLibrary.h"
Access: public Specifiers: staticBlueprintPureCustomThunk

Description

Returns a copy of the key and value stored at a given index, for iterating a map by index instead of by key lookup.

Caveats & Gotchas

  • Index refers to the map's internal sparse-array slot, not an insertion-order position — indices can have gaps after removals, so pair this with Map_GetLastIndex and skip invalid slots rather than assuming a dense 0..Length-1 range.
  • Passing the index of a removed or otherwise invalid slot returns default-constructed Key/Value rather than failing, since there is no bounds-checked return value.

Signature

static void Map_GetKeyValueByIndex(const TMap<int32, int32>& TargetMap, int32 Index, int32& Key, int32& Value);

Parameters

Name Type Description Default
TargetMap const TMap<int32, int32>& Wildcard placeholder for the map to read from.
Index int32 Index into the map's internal sparse storage; valid range is 0 to Map_GetLastIndex().
Key int32& Output: a copy of the key stored at Index.
Value int32& Output: a copy of the value stored at Index.

Return Type

void

Example

Iterate a map by index C++
// Native C++ iterates TMap directly rather than by index — the by-index pattern
// exists to give Blueprint a stable node shape for manual iteration loops:
for (const auto& Pair : Scores)
{
    // Pair.Key / Pair.Value — no index bookkeeping needed in C++
}

Version History

Introduced in: unknown

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.