I’m trying to lay out some text in a MonoBehaviour script. Now the font knows its name “Arial” and its size 13 but when I do this:
CharacterInfo info;
foreach (char c in text) {
font.GetCharacterInfo (c, out info);
Debug.Log ("Char is [" + c.ToString() + "]: " + info.advance.ToString("F6"));
}
GetCharacterInfo is returning False and I get this output:
Char is [T]: 0.000000
Char is <mark>: 0.000000</mark>
Char is [e]: 0.000000
Char is : 0.000000
So my questions are: “Why is this so?”, and “What can I do to get this information?”
Note that the monobehaviour has the [ExececuteInEditor] flag set although it doesn’t work when I play the game either. Also in Unity 5.2.0f3 on wine if that matters.
Possibly a long term problem .. see post at the end http://forum.unity3d.com/threads/font-getcharacterinfo-bug-in-wp8-win8-for-non-latin-character.200570/
– demented_hedgehogLooks like a duplicate of this one: http://answers.unity3d.com/questions/967826/getting-width-of-a-character-in-new-46-ui-system.html No one has answered except for Morgans stop gap solution :(
– demented_hedgehog