So, I have a script that creates a font at runtime and grabs a font from an array of fonts. When I do this the text looks jumbled and doesn’t resemble the font that I selected, however if I select the same font through the Unity Editor, the font looks fine. So, my question is what did I do wrong when setting the font via script?
GameObject textbox1;
public Font[] fonts;
// ^^ From the top of the script, declared in the same class.
textbox1 = Instantiate(textPrefab,new Vector3(0,0,0),Quaternion.Euler(new Vector3(90,0,0))) as GameObject;
textbox1.transform.parent = mCamera.transform;
textbox1.transform.position = new Vector3(mCamera.transform.position.x - 1, 3, mCamera.transform.position.z - 2);
textTemp = textbox1.GetComponent<TextMesh>();
textTemp.font = fonts[0];
When text font is declared at runtime:
When text font is selected from the editor: