Search Unity

Bug Text with Liberation Sans Fallback appears glitched

Discussion in 'UGUI & TextMesh Pro' started by MoonJellyGames, Jan 28, 2024.

  1. MoonJellyGames

    MoonJellyGames

    Joined:
    Oct 2, 2014
    Posts:
    331
    Hey all,

    This is one of those extremely annoying issues that I don't even know how to begin to tackle, so I'm really hoping somebody can help.

    The other day, I made a build of my game and was horrified to find that some of my text was appearing as seemingly-random characters (mostly empty spaces). I found that all of the TextMesh components that had this issue had something in common: The attached Font Asset is LiberationSans SDF - Fallback. Comparing this asset to others, I noticed that unlike every other font asset, its Atlas Population Mode is set to "Dynamic". I tried changing this to static (not fully knowing what this means), just to see what happens, and it didn't seem to make a difference. If you know what this setting means, it probably won't surprise you.

    Of course, I also tried restarting Unity and my PC altogether. No luck.

    Out of curiosity, I tried to just type into one of these component text boxes, just to see what it would come out as. The first key I hit was the spacebar, and instantly, the problem fixed itself across every scene.

    I made a couple of builds before it came up again (in build), but when I went back into the editor, the problem wasn't showing up at all. The next build didn't have the problem either.

    But now, it's happening and the trick from before doesn't seem to solve it. I thought it might be the same as this problem:

    https://issuetracker.unity3d.com/is...llback-font-disappears-after-saving-the-scene

    Which is, apparently a bug that was fixed in 2022 versions of Unity. I was apprehensive about updating Unity mid-project as this has been a headache for me in the past, but I went ahead and did it anyways. (I was previously using 2021.3.27f1 and now have 2022.3.18f1).

    I'm here, writing this post, so you know that it didn't fix the problem.

    One other thing that may be worth mentioning is that I haven't done anything with my font assets in quite a while, so this problem seemed completely random. The only thing I can think of is that it might have something to do with Hot Reload, which I recently added, which cut my script compilation time from 47s+ to around 10s. I can't imagine why it would have anything to do with that, but it's the only thing I've changed/added that could have affected the project in an unexpected way.

    If more information is needed to help me troubleshoot, please let me know, and thank you for your time.