UKismetMathLibrary::Percent_ByteByte
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Returns the remainder of A divided by B (A % B). Useful for wrapping values within a range.
Caveats & Gotchas
- • Modulo by zero (B=0) triggers a Blueprint runtime error and returns 0; guard B before calling in latency-sensitive paths.
- • Because uint8 is always non-negative, the result is always in [0, B-1] — unlike signed-integer modulo which can return negative values.
Signature
static UE_INL_API uint8 Percent_ByteByte(uint8 A, uint8 B = 1); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| A | uint8 | Dividend. | — |
| B | uint8 | Divisor (modulus). | 1 |
Return Type
uint8 Example
Cycling through a byte index C++
uint8 SlotIndex = UKismetMathLibrary::Percent_ByteByte(CurrentSlot + 1, SlotCount);
// Wraps back to 0 after the last slot Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?