UKismetMathLibrary::Conv_ByteToInt
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticBlueprintPureBlueprintAutocast
Description
Widens a byte (uint8) to a 32-bit integer. The conversion is lossless and always produces a non-negative result in the range 0–255.
Caveats & Gotchas
- • The result is always non-negative (0–255) because uint8 is unsigned. Code that compares the result to negative numbers is always deterministic — the comparison will always be false for any valid byte input.
- • In Blueprint, byte pins are often backed by a UENUM, and when a UENUM-typed byte is auto-cast to Integer the resulting integer represents the enum's numeric value, which may not match your expectation if the enum is non-contiguous.
Signature
static UE_INL_API int32 Conv_ByteToInt(uint8 InByte) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| InByte | uint8 | The byte value (0–255) to widen to a 32-bit integer. | — |
Return Type
int32 Example
Use a byte health value in integer arithmetic C++
uint8 ByteHealth = GetCompressedHealth(); // 0-255
int32 ScaledHealth = UKismetMathLibrary::Conv_ByteToInt(ByteHealth) * 4; // 0-1020 Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?