For text display in Unity3D. What would I do if I wanted to remove everything except the two decimal places from the float? To clarify what I want to do, see the example below:
Say I have floats:
1.25013
1,9012
1,029
Now, in Unity, what should I do if I want to reduce them, so that there are only two decimal points left, will I return 1.25, 1.90 and 1.02 before displaying the string, for example, on UI.Text?
I was looking for string formatting and stuff like Math.Floorwithout success.
source
share