Search
 
SCRIPT & CODE EXAMPLE
 

CPP

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));
Comment

unity round float to nearest 10


//int
int sayi;
int = ((int)(((int)(sayi/10))*10));
//float
float sayi;
sayi = ((float)(((int)(sayi/10))*10));
Comment

PREVIOUS NEXT
Code Example
Cpp :: random number cpp 
Cpp :: c++ initialize array 1 to n 
Cpp :: access part of string in c++ 
Cpp :: map in c++ sorted descending order 
Cpp :: c++ printf char as hex 
Cpp :: how to put bitset into a string in c++ 
Cpp :: loop through a vector in c++ 
Cpp :: matplotlib hide numbers on axis 
Cpp :: random number of 0 or 1 c++ 
Cpp :: how to make a list in c++ 
Cpp :: how to clear vector c++ 
Cpp :: max heap in c++ 
Cpp :: c++ create multidimensional vector 
Cpp :: c++ cout colored output xcode 
Cpp :: get window position 
Cpp :: why we use iostream in C++ programming 
Cpp :: find max element in array c++ 
Cpp :: sort a 2d vector c++ stl 
Cpp :: how to get the type of a variable in c++ 
Cpp :: reverse function in cpp string 
Cpp :: are strings mutable in c++ 
Cpp :: cudamemcpy 
Cpp :: c++ lambda 
Cpp :: how to find last character of string in c++ 
Cpp :: c++ if else 
Cpp :: function in struct c++ 
Cpp :: fizzbuzz c++ 
Cpp :: c ifdef 
Cpp :: Reverse words in a given string solution in c++ 
Cpp :: c++ function as paramter 
ADD CONTENT
Topic
Content
Source link
Name
3+9 =