Question by
xyHeat · May 14, 2016 at 02:29 PM ·
scripting problemfloatmathf
Mathf.Round ? [C#]
Hey everybody ! I'm trying to round a float without decimals with : Mathf.Round(float f);
But it return, for exemple, 10.8. Some one know how I can get just 10 ? (or 11)
Thanks you, bye, xyHeat
Comment
Best Answer
Answer by JedBeryll · May 14, 2016 at 02:41 PM
Mathf.Floor() rounds down
Mathf.Ceil() rounds up
Mathf.FloorToInt() rounds down and returns int
Mathf.CeilToInt() rounds up and returns int
or you can just cast it to integer like this: int i = (int) f;