How to clamp a float?

0 and 100 are integer constants, not floating point constants. The compiler doesn’t know whether you want to convert them to floats and do float-clamping, or convert your float to an int and do int-clamping.

To resolve the ambiguity, do FMath::Clamp(MyFloat, 0.0f, 100.0f).

2 Likes