Unity font warnings

If you've ever seen warnings like these:

Warning screenshot. Font size and style override are only supported for dynamic fonts.

Most likely in your project you're using editable fonts. That is, not dynamically generated directly from ttf, but a bitmap that you created yourself. And sometimes Unity can glitch like this:

Screenshot of UI Text inspector with italic style applied to a static font

Although this specific case is not really a glitch, but standard behavior when creating an input field. By default, Unity assigns italic style for placeholder text and some default font (usually Arial). And if you change this font to your non-dynamic one, Unity will start complaining with warnings from the first screenshot. After all, it doesn't know how to make italic from your strange font image. In general, there can be many reasons for such a message, but they all boil down to the fact that you're trying to apply some styles/filters/sizes, which are inherently dynamic entities, to a static font.

You can fix the last case by simply changing the font for the placeholder to any dynamic one, then changing the style to normal, then returning your original font. If you don't change the font to another dynamic one - Unity won't let you change the style setting.

But if you have a gazillion such objects, you can do it even simpler. Provided that you have Linux/Mac/Cygwin or some other "linux under windows" and in the project, meta file serialization is set to force text.

Go to the folder with your prefabs that need to fix the font problem. There run the command:

find ./ -type f -name "*.prefab" -exec sed -i -e 's/m_FontStyle: 2/m_FontStyle: 0/g' {} \;

What's happening here, part by part

Find in the current folder, recursively including subfolders, all files whose names end with .prefab
find ./ -type f -name "*.prefab"

For each of the found files, run
-exec ... {} \;

Text editor sed
sed

with parameters: -i means save changes after applying the command
-i

parameter -e followed by the editing command
-e

find in each line m_FontStyle: 2 and replace with m_FontStyle: 0 (2 is italic, 0 - normal)
's/m_FontStyle: 2/m_FontStyle: 0/g'

You can read more about sed on Daniel Robbins' website