- Home /
Font.CacheFontForText is 87.3% in the profiler and causes a HUGE lag spike
Hello everyone, I am using a dynamic font, but Best Fit is not checked and pixel perfect is unchecked as well. When my character 1st shoots an enemy combat text gets displayed and there is a HUGE lag spike. Any idea how to remedy this performance problem?
unity-profiler.png
(243.7 kB)
Comment
Answer by MGGDev · Feb 11, 2019 at 03:25 PM
Check out these solutions. Some of them are:
Use static font.
Set Rendering Type to OS Default
Uncheck 'Incl. Font Data' on the font file
Write this in Update():
string fontGlyphsString = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()-_+=~`[]{}|\\:;\"'<>,.?/ "; font.RequestCharactersInTexture(fontGlyphsString);