Problem with broken text in Unity canvas

For no particular reason text in our grid gets completly broken sometimes. The underlying string is correct its teh UI thats messed up

Looks like this

Yes, I’ve seen that a few times (5.4.2f2). Obviously a bug. Try raising an issue?

They probably want a repo project which I cant give them, it does not happen often

I also found this bug, I believe it comes from the way Unity handles dynamic fonts. For now I haven’t been able to find a solution as well. If you do find a solution please let me know.

1 Like

I have the same issue, and I also think it is related with the way Unity handle dynamic fonts.

With dynamic fonts, when a new character is displayed, it is added to a big atlas texture. When using the same character with a different font size, it is considered to be a new character and is also added to the big texture.

The issue seems to be that when that big texture reach the maximum texture size supported by the device, it may break and display weird stuff.

The expected result would be that it would use additional texture(s) when needed, and continue to work properly. Another option that could help would be to be able to clear that font texture.

As a temporary solution, I am duplicating the font asset itself, and assigning different version of the same font asset into my text components according to their text size. Since Unity seems to use one font atlas texture per font asset, it’s the only way I could find to force using multiple texture images. The downside of this solution is the need to maintain that text-usage/font-version relationship, which can be non-trivial in a big project if you don’t have centralized text styles.

Another (partial) solution to minimize the issue would be to reduce the number of different font sizes used in the project.

Thanks guys, been busy with other aspects, will revisit this soon, but could it be considered a bug with Unity then?