unity round to nearest 10 code example
Example 1: unity round float to nearest 100
int sayi;
int = ((int)(((int)(sayi/100))*100));
float sayi;
sayi = ((float)(((int)(sayi/100))*100));
int yuvarlama;
int sayi;
int = ((int)(((int)(sayi/yuvarlama))*yuvarlama));
float yuvarlama;
float sayi;
sayi = ((float)(((int)(sayi/yuvarlama))*yuvarlama));
Example 2: unity round float to nearest 10
int sayi;
int = ((int)(((int)(sayi/10))*10));
float sayi;
sayi = ((float)(((int)(sayi/10))*10));
Example 3: unity round int
int sayi = 0;
sayi = ((int)(((int)(sayi / 10)) * 10));
float sayi;
sayi = ((float)(((int)(sayi/10))*10));