- Home /
Setting a font at runtime wrong?
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:
Answer by pfreese · Apr 07, 2016 at 06:04 PM
That looks like a bug; submit a report for it and make sure it includes your project.
Your answer
Follow this Question
Related Questions
Fonts for commercial mobile game (Android) 1 Answer
Outer glow (outline) on a Text Mesh 0 Answers
Getting pixel font to look decent 1 Answer
Can't change UGUI text color after assign material ? 0 Answers
Some Text Is Blurry Some Text Is Not 4 Answers