PluginsUDCoreFeaturesFunction Library
Array Functions
Array navigation and manipulation utilities
The UUDCoreArrayFunctionLibrary provides utilities for array navigation and manipulation, with support for looping behavior.
Index Navigation
Array_NextIndex
Returns the next index in an array, with optional looping.
When the current index is the last element:
- If
bLoopistrue, returns0(wraps to beginning) - If
bLoopisfalse, returns the last valid index

TArray<int32> MyArray = { 0, 1, 2, 3 };
int32 CurrentIndex = 2;
bool bLoop = true;
int32 NextIndex = UUDCoreArrayFunctionLibrary::Array_NextIndex(MyArray, CurrentIndex, bLoop);
// Result: 3
// At the last element with looping:
CurrentIndex = 3;
NextIndex = UUDCoreArrayFunctionLibrary::Array_NextIndex(MyArray, CurrentIndex, bLoop);
// Result: 0 (loops back)Parameters
| Name | Type | Description |
|---|---|---|
TargetArray | TArray<T> | The array to navigate |
Index | int32 | The current index |
bLoop | bool | If true, wrap to beginning when at end |
Returns
| Name | Type | Description |
|---|---|---|
ReturnValue | int32 | The next index |
Array_PreviousIndex
Returns the previous index in an array, with optional looping.
When the current index is 0:
- If
bLoopistrue, returns the last valid index (wraps to end) - If
bLoopisfalse, returns0

TArray<int32> MyArray = { 0, 1, 2, 3 };
int32 CurrentIndex = 1;
bool bLoop = true;
int32 PrevIndex = UUDCoreArrayFunctionLibrary::Array_PreviousIndex(MyArray, CurrentIndex, bLoop);
// Result: 0
// At the first element with looping:
CurrentIndex = 0;
PrevIndex = UUDCoreArrayFunctionLibrary::Array_PreviousIndex(MyArray, CurrentIndex, bLoop);
// Result: 3 (loops to end)Parameters
| Name | Type | Description |
|---|---|---|
TargetArray | TArray<T> | The array to navigate |
Index | int32 | The current index |
bLoop | bool | If true, wrap to end when at beginning |
Returns
| Name | Type | Description |
|---|---|---|
ReturnValue | int32 | The previous index |
Use Cases
Cycling Through Menu Options
// Player presses "Next"
CurrentSelection = UUDCoreArrayFunctionLibrary::Array_NextIndex(MenuOptions, CurrentSelection, true);
// Player presses "Previous"
CurrentSelection = UUDCoreArrayFunctionLibrary::Array_PreviousIndex(MenuOptions, CurrentSelection, true);Playlist Navigation
// Next track (loop when at end)
CurrentTrack = UUDCoreArrayFunctionLibrary::Array_NextIndex(Playlist, CurrentTrack, true);
// Previous track (loop when at beginning)
CurrentTrack = UUDCoreArrayFunctionLibrary::Array_PreviousIndex(Playlist, CurrentTrack, true);Non-Looping Selection
// Navigate without looping (useful for lists with a clear beginning/end)
CurrentIndex = UUDCoreArrayFunctionLibrary::Array_NextIndex(Items, CurrentIndex, false);
// At the last element, this returns the last index instead of loopingThese functions work with any array type in Blueprints and are templated in C++ for type safety.
Summary
| Function | Description |
|---|---|
Array_NextIndex | Get the next index with optional looping |
Array_PreviousIndex | Get the previous index with optional looping |