UKismetMathLibrary::MinOfByteArray
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPureUFUNCTION
Description
Finds the minimum byte (uint8) in an array and its index. Returns MinValue=0 and IndexOfMinValue=-1 on an empty array.
Caveats & Gotchas
- • Since uint8 minimum is 0, an empty array's sentinel of MinValue=0 is indistinguishable from a real minimum of 0 — always check IndexOfMinValue != -1.
- • In Blueprint, byte arrays often represent enum values; the 'minimum' is the enum member with the lowest underlying integer, which may not have any semantic ordering in your enum.
Signature
static ENGINE_API void MinOfByteArray(const TArray<uint8>& ByteArray, int32& IndexOfMinValue, uint8& MinValue); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| ByteArray | const TArray<uint8>& | The array to search. | — |
| IndexOfMinValue | int32& | Output: index of the minimum value. -1 if array is empty. | — |
| MinValue | uint8& | Output: the minimum byte value found. 0 if array is empty. | — |
Return Type
void Example
Find the lowest priority byte value C++
TArray<uint8> Priorities = { 4, 1, 3, 1, 2 };
int32 Index;
uint8 Min;
UKismetMathLibrary::MinOfByteArray(Priorities, Index, Min);
// Min == 1, Index == 1 Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?