using SetText with a {0:0.#} format doesn't work as expected

I have a float that I’m passing to the TextMeshProUGUI component using SetText. It doesn’t seem to work the same as string.Format where the # is optional.
If the number is 5.0 it’ll show as 5. With TMPro it shows as #5.
I tried using {0:0.0} as format but it always shows the .0.

The SetText() function has limited formatting support where as such it doesn’t offer all the functionality of string.Format.

I will try to take a closer look at SetText() over the next week or so and see if I can add some additional formatting functionality to it.

1 Like