Hi there,
I’ve been working with UI/Text for many platforms lately, and I’m now facing an issue that is generally know as “missing letters/glyphs on a specific device/condition”. Generally, this happens as Unity renders and saves font as texture runtime - depending on the font chosen by best-fit. The things gets worse when changing fonts at runtime for localization, for example. Changing to a font that suits another character set, during the same runtime/play session (chinese, japanese, korean, arabic, etc), helps to increase the memory used by Unity.
So… I would like to know more, if there’s a de-facto way to work with things like this. For example, is it possible to wipe the data of a font that is not used anymore? Or any way to not allow the font memory to increase without limits?
I suspect the issue is related to the use of Best Fit where in the case of using the UI.Text which uses the legacy text system which only supports bitmap font results in multiple copies of the same glyph being added to the atlas texture(s) which causes them to very quickly grow to large sizes.
I am assuming that you are pretty far into the project where you most likely need to stick to UI.Text instead of TextMeshPro. In which case, I would suggest limiting the use of Best Fit. By limiting, I mean perhaps only using 1 text object to figure out the optimum point size that should be used by all text objects or groups of text objects.
Although this post is related to TMP, it does exampling my thoughts on how Text Auto Size / Best Fit should be used. Again, the idea is to minimize the numbers point sizes used which results in multiple copies of the same glyph being added to the atlas texture thus causing these to quickly grow in size.
I am not sure if there is a way to clear dynamic font data in the Legacy text system like we can with TMP. I will check tomorrow and follow up once I have more information.