It seems that adjusting the order of Fallback Fonts via code does not refresh the font.
Even after adjusting and then searching for all TMP Text objects and calling tmpText.ForceMeshUpdate(true);//this worked in 2022, the font fails to refresh. Strangely enough, font refresh only seems to occur when manually adjusting the order in the Inspector.
I have tried similar methods, such as using TMPro_EventManager.ON_FONT_PROPERTY_CHANGED(true, mainFont);//BY AI suggest to force the font refresh, but these attempts have been unsuccessful.
Has anyone else experienced a similar issue? Are there any alternative solutions or workarounds that you have found effective? Any insights or tips would be greatly appreciated!
Hello, I experienced the exact same issue as you.
While exploring the internal code, I luckily discovered a specific function, and calling it resolved the problem.
To get straight to the point, in my case, after modifying the fallback fonts, calling TMP_ResourceManager.ClearFontAssetGlyphCache() solved the issue.
I couldn’t find any examples of how to use this function through a search, but it seems to have been introduced in 2.2.0-preview.3.
Additionally, according to the Changelog for version 4.0.0-pre2, the function is described as follows:
Added ClearFontAssetGlyphCache() function to the TMP_ResourcesManager to enable clearing the font asset fallback glyph cache.
And yes, you’re right. In the Editor environment, simply calling ClearFontAssetGlyphCache works, but I just realized that in the build environment, also need to call ForceMeshUpdate lol