Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

TextMesh Pro Does fallback Font files load on demand?

Discussion in 'UGUI & TextMesh Pro' started by Arkuni, Jun 1, 2022.

  1. Arkuni

    Arkuni

    Joined:
    May 30, 2013
    Posts:
    42
    I am making an online game where any player can be exposed to characters from any langauge at any time.
    I know that using Dynamic TMP Font Assets as fallbacks is a way to reduce the size of the Font Atlas.

    My question:
    Are the Font files (referenced by the TMP Font Assets) loaded as soon as the game starts or only on demand when the Dynamic Font Asset is being tried as fallback?

    The dynamic loading of characters is pretty smart, but the font files themselves can be quite chunky as well.
     
  2. sarahnorthway

    sarahnorthway

    Joined:
    Jul 16, 2015
    Posts:
    68
    I think the answer is YES they're loaded at game start by default, UNLESS you set Clear Dynamic Data on Build to true.

    Fallback font support for JP, KR, SC, TC was easy to set up - just drop in some Noto fonts and right-click Create > Text Mesh Pro > Font Asset, then add them to the fallback list in TMP Settings. It defaults them to dynamic, 1024x1024, with Multi Atlas Textures and Clear Dynamic Data on Build off.

    I tested with some sample text, then made a build and took a look in the Memory Profiler. The fallback font textures were loaded into memory at game start and contained characters from my in-editor tests.

    I then turned on Clear Dynamic Data on Build. I also turned on Multi Atlas Textures so I could make the fallback atlases smaller without worrying about running out of space for hanzi/kanji characters.

    Tested again, now the font textures are not present in memory until I display them on the screen.

    If you ran into any more tips / info about this since your post please let me know!