I want to limit the display in my EditorGUILayout.FloatField to 2 decimal places. Is there a way to do this?
Thanks
I want to limit the display in my EditorGUILayout.FloatField to 2 decimal places. Is there a way to do this?
Thanks
There are a few suggestions in this other UA thread.
If you’re going to do this a lot, there are pretty good ways; if it’s more of a one-off thing, you could always convert float → string with X digits → rounded float.
float f = ... //some float
f = float.Parse(f.ToString("F2"));
Thanks rutter, the last line is perfect for my use as I can use it directly in FloatField() without having to declare a separate float.
– JoeW97