UKismetArrayLibrary::SortIntArray
#include "Kismet/KismetArrayLibrary.h"
Access: public
Specifiers: staticBlueprintCallable
Description
Sorts an array of 32-bit integers in place by numeric value. Shows in the Blueprint palette as "Sort Integer Array".
Caveats & Gotchas
- • Sorts in place and mutates TargetArray directly; there is no non-mutating overload that returns a sorted copy.
- • Only supports int32 — for 64-bit integers use SortInt64Array instead, since implicit truncation is not performed.
Signature
static void SortIntArray(UPARAM(Ref) TArray<int32>& TargetArray, bool bStableSort = false, EArraySortOrder SortOrder = EArraySortOrder::Ascending); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| TargetArray | TArray<int32>& | The array of integers to sort in place. | — |
| bStableSort | bool | If true, uses a stable sort that preserves the relative order of equal elements, at a performance cost. | false |
| SortOrder | EArraySortOrder | Whether to sort ascending or descending. | EArraySortOrder::Ascending |
Return Type
void Example
Sort scores descending C++
TArray<int32> Scores = { 42, 7, 99, 15 };
UKismetArrayLibrary::SortIntArray(Scores, false, EArraySortOrder::Descending);
// Scores is now [99, 42, 15, 7] Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?