Unreal Engine 5 · Blueprint → C++
Round / Truncate in Unreal Engine 5 C++UE Docs
The Round and Truncate Blueprint nodes map to FMath::RoundToInt, FMath::TruncToInt, and FMath::CeilToInt in Unreal Engine 5 C++.
Blueprint node & C++ equivalent
int32 Rounded = FMath::RoundToInt(Value);
int32 Truncated = FMath::TruncToInt(Value);
int32 Ceiled = FMath::CeilToInt(Value);What do the Round and Truncate nodes do?
These nodes convert a floating-point value to a whole number using different rules. Round goes to the nearest integer, Truncate drops the fractional part toward zero, and Ceil rounds up to the next integer.
Choosing the right one matters when converting positions to grid cells, computing UI counts, or quantizing values.
The C++ equivalent
Use FMath::RoundToInt(Value) for nearest-integer rounding, FMath::TruncToInt(Value) to truncate toward zero, and FMath::CeilToInt(Value) to round up. Each takes a float and returns an int32.
Unreal also provides FMath::FloorToInt to round down, plus float-returning variants like FMath::RoundToFloat when you want to keep the value as a float.
When to use it in C++
Reach for RoundToInt when you want the closest cell or count, TruncToInt when you specifically want to discard the fraction, and CeilToInt to guarantee enough capacity, for example computing how many rows a list needs. Remember that truncation differs from floor for negative numbers.
Frequently asked questions
What is the C++ equivalent of the Round node in UE5?+
Use FMath::RoundToInt(Value), which rounds a float to the nearest int32. For float output, use FMath::RoundToFloat.
What is the difference between TruncToInt and FloorToInt?+
TruncToInt rounds toward zero, so -2.7 becomes -2. FloorToInt always rounds down, so -2.7 becomes -3. They match only for non-negative values.