Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

round to float unity

float f = 3.16856f;
f = Mathf.Round(f * 10.0f) * 0.1f;
//Which will give 3.2f


//If you want 2 decimal points then,


float f = 3.16856f;
f = Mathf.Round(f * 100.0f) * 0.01f;
//Which results in 3.17f, and so on.
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
Csharp :: vue.createapp is not a function 
Csharp :: import C++ into C# 
Csharp :: c# copy file to directory 
Csharp :: Character Controller unity isGrounded is false 
Csharp :: Debug raycasthit2d unity 
Csharp :: unity 2d how to set an object or the mouse position 
Csharp :: c# how-to-download-image-from-url 
Csharp :: wpf bind to self 
Csharp :: c# new line in messagebox 
Csharp :: how get url in laravel 
Csharp :: print out a dictionary c# 
Csharp :: stop audio unity 
Csharp :: how to move a object in unity c# 
Csharp :: unity change text color 
Csharp :: convert timestamp to datetime c# code 
Csharp :: create new gameobject unity 
Csharp :: cannot convert string to long c# 
Csharp :: how to create directory folder in c# 
Csharp :: c# empty IEnumerable 
Csharp :: c# print 
Csharp :: c# ipaddress from localhost 
Csharp :: how to make rb.addforce 2d 
Csharp :: unity how to load up a scene 
Csharp :: oncollisionenter unity 
Csharp :: get apps execution path with app name c# 
Csharp :: sum of digits in c# 
Csharp :: minheap c# 
Csharp :: get random from list c# 
Csharp :: turtle graphics face in direction 
Csharp :: Arrange array element in right and left order starting from least element 
ADD CONTENT
Topic
Content
Source link
Name
7+2 =