From time to time, when I change or setActive some Text field in game, font.cachefontfortext spike shows up in profiler. In that moment all text fields in canvas flickers in a moment, and after that shows up again. It also happens to show some random characters while flickering. Any idea how to prevent that? All fonts are dynamic fonts. (I cant change that) Note that it happens only in actual build, in editor it doesn’t.
Things I tried:
-
Reduced BestFit components to as shortest range as possible on all text objects with BestFit on them
-
Tried to pre-cache all glyphs in Awake and Update with:
string glyphsString = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=~`{}|\:;"'<>,.?/ ";
font.RequestCharactersInTexture(glyphsString, textComponent.fontSize, textComponent.fontStyle);
Reducing BestFit helped a bit, and flickers are more rare at start of game, but after a while they show up again. RequestCharactersInTexture seems like it doesn’t have any effect whatsoever…