22 Temmuz 2013 Pazartesi

Unity3d - Round double / float values

Hi,
To be able to round the values in unity csharp you need the code below:


float rawValue = 5.521f;
rawValue = Mathf.Round(rawvalue * 100f) / 100f);
//it should return 5.5



In order to increase decimals, just use 1000 or 10000 etc.

Hiç yorum yok:

Yorum Gönder