UKismetArrayLibrary::SortFloatArray
#include "Kismet/KismetArrayLibrary.h"
Access: public
Specifiers: staticBlueprintCallable
Description
Sorts an array of floating-point values in place by numeric value. The parameter type is TArray<double> since Blueprint's "float" maps to double-precision internally.
Caveats & Gotchas
- • Sorts in place and mutates TargetArray directly; there is no non-mutating overload.
- • The underlying element type is double even though the Blueprint node reads as "float" — matters if you're calling this from C++ against a TArray<float>, which will not bind without conversion.
Signature
static void SortFloatArray(UPARAM(Ref) TArray<double>& TargetArray, bool bStableSort = false, EArraySortOrder SortOrder = EArraySortOrder::Ascending); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| TargetArray | TArray<double>& | The array of floating-point values 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 distances ascending C++
TArray<double> Distances = { 350.5, 12.75, 980.0, 4.2 };
UKismetArrayLibrary::SortFloatArray(Distances, false, EArraySortOrder::Ascending);
// Distances is now [4.2, 12.75, 350.5, 980.0] See Also
Tags
Version History
Introduced in: unknown
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?