Answers for "unity round to nearest x"

C++
4

unity round float to nearest 10

//int
int sayi;
int = ((int)(((int)(sayi/10))*10));
//float
float sayi;
sayi = ((float)(((int)(sayi/10))*10));
Posted by: Guest on January-15-2021
0

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));
Posted by: Guest on May-08-2020

Browse Popular Code Answers by Language