UKismetMathLibrary::Add_ByteByte
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Adds two byte values and returns the sum. The default value of B=1 makes it convenient as an increment node in Blueprints.
Caveats & Gotchas
- • No overflow protection: adding values whose sum exceeds 255 silently wraps to (A+B) % 256 in C++. Blueprint does the same — there is no runtime error.
- • When used in a tight Blueprint loop as an increment (e.g. A=254, B=1), the result wraps to 0, which can create infinite loops if you are checking for a terminal value above 255.
Signature
static UE_INL_API uint8 Add_ByteByte(uint8 A, uint8 B = 1); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | uint8 | First operand. | — |
| B | uint8 | Second operand. | 1 |
Return Type
uint8 Example
Incrementing a byte counter C++
uint8 NextLevel = UKismetMathLibrary::Add_ByteByte(CurrentLevel, 1);
// Wraps to 0 if CurrentLevel is 255 Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?