RealDocs

UKismetArrayLibrary::SortByteArray

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

Description

Sorts an array of bytes (uint8) in place by numeric value.

Caveats & Gotchas

  • This overload is also the one the Blueprint editor picks for enum arrays exposed as byte-backed TArray<uint8> nodes, since Blueprint enums compile down to byte values — sorting will be by the enum's underlying numeric value, not its display order.
  • Sorts in place and mutates TargetArray directly; there is no non-mutating overload.

Signature

static void SortByteArray(UPARAM(Ref) TArray<uint8>& TargetArray, bool bStableSort = false, EArraySortOrder SortOrder = EArraySortOrder::Ascending);

Parameters

Name Type Description Default
TargetArray TArray<uint8>& The array of bytes 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 a byte array ascending C++
TArray<uint8> Values = { 200, 10, 128, 0 };
UKismetArrayLibrary::SortByteArray(Values, false, EArraySortOrder::Ascending);
// Values is now [0, 10, 128, 200]

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.