unity round a number code example
Example 1: unity round
Mathf.Round(10.2f);
Example 2: unity round int
//int
int sayi = 0;
sayi = ((int)(((int)(sayi / 10)) * 10));
//float
float sayi;
sayi = ((float)(((int)(sayi/10))*10));
Example 3: how to round to nearest whole number unity
// Prints 10
Debug.Log(Mathf.Round(10.0f));
// Prints 10
Debug.Log(Mathf.Round(10.2f));
// Prints 11
Debug.Log(Mathf.Round(10.7f));