Search Unity

The drawbacks of using dynamic font assets exclusively

Discussion in 'UGUI & TextMesh Pro' started by jlanisdev, Nov 22, 2020.

  1. jlanisdev

    jlanisdev

    Joined:
    Jan 18, 2016
    Posts:
    76
    I want to understand more about the disadvantages of using dynamic font assets exclusively, as opposed to the recommended approach of using static font assets + only using dynamic as a fallback.

    I have gone through the documentation and videos, but I still don't have a full understanding of what the main drawbacks/pitfalls are of exclusively using dynamic fonts. I presume performance is the main reason to use static fonts, but is the performance difference really that significant if the atlas is only getting updated periodically? Furthermore, dynamic fonts automatically save their atlas when a new glyph is detected while running within the unity editor. Doesn't this mean that the likelihood of runtime atlas updates would be reduced significantly, or perhaps removed all together?
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,596
    The main downside to only using dynamic font assets as opposed to a primary static font asset + dynamic fallback is mainly performance.

    Although dynamic font asset performance when adding new glyphs at runtime is totally fine when dealing with user input or few characters, this overhead would be much more significant if you were to instantiate a text object containing over 100 new glyphs and characters. This is where it is best to use a static font asset which contains all the known characters used in your UI / dialogues / in the project as these are known at build time.

    The main use case for running full dynamic is when trying to use system fonts due to build size restrictions. In those cases, users will create dynamic font asset when the game or scenes are first loaded and also prepopulate those dynamic font assets as well. This is a viable way to hide this performance overhead.

    It is important to remember that changes to dynamic font assets in the Editor are persistent but not in players / builds. As such, dynamic font asset always reset to their default / build / ship state between each play session.

    Many users now run full dynamic with Multi Atlas Texture enabled during most of their development cycle as this makes it convenient and provides them with a better understanding of glyph and character coverage during development. As they get closer to release, they then switch to a combination of static and dynamic font assets. The following two videos cover a lot of this information.