I am trying to align TextMesh Pro text fields showing float numbers in Unity, so that the decimal point stays at a fixed horizontal position regardless of the number value.
If I am using a font where the numbers have equal width (monospace numbers) then I can get around the issue by formatting the number to show a fixed number of decimal places and then aligning the text to the right. But does anyone know if there is a (simple) way of telling TextMesh Pro to base its alignment on a particular character?
I guess that what I am looking for would be some way of offsetting the alignment, not by a fixed distance (px, em, %), but by a number of characters (of varying width).
I could probably do something like getting the TextInfo for the particular number (string), find the location of the decimal point and then maybe modify the margins of the text field so that the decimal point stays fixed, but that feels like a bit of a hack. Does anyone have ideas for better solutions?
Best regards, Jakob