- Home /
How to change text on a TextMesh with a non-dynamic font on iOS?
I was using TextMesh and changing the text on it on other platforms without issues before, but when I started trying to change the text on iOS I started getting errors such as:
Font size and style overrides are only supported for dynamic fonts.
UnityEngine.TextMesh:set_text(String)
This is how I was changing the text (without issues on other platforms):
UIScore.GetComponent<TextMesh>().text = Score.ToString();
I made sure all my fonts were set to Unicode, and the Unity Script Reference doesn't list the text member of TextMesh as a dynamic font property. How can I change the text on my fonts without issues?
Answer by flamy · Aug 29, 2012 at 05:51 AM
No the reason for the error is you are setting font size for the text mesh. Font size over rides are not supported in mobile platforms now.
You have to take a font of a bigger size and control the size of the text using scale value not the font size. If font size is not 0 you will get this error. The same error will come if font style is not normal.
Thank you! It was showing the error because the object had a dynamic property, but on a line of code that had nothing to do with that. I guess it just spouts that error, if it exists, anytime that object is accessed or manipulated.