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 "Unable to add character to font asset's atlas texture"

Discussion in 'UGUI & TextMesh Pro' started by CwalRoo, Nov 19, 2022.

  1. CwalRoo

    CwalRoo

    Joined:
    Aug 22, 2022
    Posts:
    3
    Unable to add the requested character to font asset [DroidSansFallback SDF]'s atlas texture. Please make the texture [DroidSansFallback SDF Atlas] readable.

    We are getting the above warning all over the place (each time the font is called).
    The font works properly, and the atlas seems to be in the correct place...
    How can we resolve this massive error spam?

     

    Attached Files:

  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,581
    The above message is displayed when the atlas texture of the font asset is not set to readable.

    You can verify the state of this flag by selecting the atlas texture of the font asset in the Inspector in Debug Mode as seen below.

    upload_2022-11-21_15-1-39.png
    Selected the atlas texture of the font asset.

    upload_2022-11-21_15-2-20.png
    Set the Inspector to Debug mode.

    upload_2022-11-21_15-2-54.png

    Check if texture Is Readable.

    NOTE:
    While reviewing your post, I noticed that your atlas texture is set to 8192 x 8192 which will result in significant memory overhead and is likely unnecessary given your font asset Generation Setting and relatively low sampling point size.

    Instead I would recommend setting the Atlas Width and Height to 1024 x 1024 with "Multi Atlas Texture" and "Clear Dynamic Data on Build" enabled.

    The "Multi Atlas Texture" option enables the font asset to add new atlas textures as needed when the main 1024 x 1024 is full. This option makes it possible for a dynamic font asset to display every character contained in the source font file.

    The "Clear Dynamic Data on Build" option, clears the Character and Glyph tables when creating a build or closing the Editor. It also reset the Atlas Texture to size zero where its contribution to build size will be marginal. At runtime, when trying to add the first character and glyph to the atlas texture, we check if the atlas texture is uninitialized (ie. size zero) and if so it gets resized to the specified size in the Generation Settings.

    Let me know if you have any questions about the above?
     
  3. CwalRoo

    CwalRoo

    Joined:
    Aug 22, 2022
    Posts:
    3
    Thank you for the response!
    After checking the box to make it readable, it appears the errors stop, but the font also seems to stop working:




    Also, thank you for the advice for the size of the atlas, the thing is I don't get how you do multi texture with the Asset Creator. If I select 1024*1024 only a few of the character are taken in consideration out of the 28K I've in range (it's the full fall back for non-classic-latin alphabets, as we support Simplified Chinese, Korean, Japanese etc...) I saw where to check the multi atlas texture on the already-made asset, but not beforehand.

    The only thing that was changed was the "Is Readable" selector.
     
    Last edited: Nov 22, 2022
  4. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,581
    You cannot do multi atlas texture with the Font Asset Creator. Ie. have the Font Asset Creator create more than one atlas texture. This is perhaps a new feature that could be added in the future.

    Having said that, since your font asset is Dynamic, you do not need to try to add any characters to it since those will be added at runtime dynamically.

    A Dynamic font asset with Multi Atlas texture enabled will make it possible to handle every single character and glyph contained in the font file at runtime. As one atlas texture gets filled up, a new one gets created as needed for the additional characters.

    The only thing you have to keep in mind is that dynamic font asset have a higher performance overhead vs static as we need to add characters and glyphs at runtime to the font asset and atlas texture(s). On the other hand, this higher performance overhead is still much faster than any human can type so using dynamic font assets to handle user input is ideal. Where it is not ideal is when you go from an empty dynamic font asset and you try to display a large amount of text right from the start like a large dialogue screen or license agreement.

    The recommended workflow in terms of the use of Static and Dynamic font assets is as follows:

    Static font assets should be used for all known text for any given language or groups of languages. Known text is all the text contained in your menus, UI, dialogues that is known at build time.

    Most of the time, the known text for any given language is not that many characters even for CJK unless you are creating a novel or text adventure game. Typically, you will have one static font asset for Latin text and one for Japanese, another for Korean and lastly one more for Chinese. Depending on the amount of text, both Chinese Traditional and Simplified can fit in the same static font asset. Most of the time, a 1024 x 1024 atlas texture size will work with good sampling quality.

    Each of these static font assets should have a local fallback that is dynamic to handle any unknown characters coming from user input for instance.

    Adding new characters and glyphs to any of these dynamic font assets as users are typing will be noticeable by them as although this performance overhead is significant on low end devices, it is still much faster than they can type.

    Be sure to use the same Sampling Point Size to Padding ratio between the Static and Dynamic Fallback font assets. There are several threads / posts on the forum about this topic.
     
  5. halley

    halley

    Joined:
    Aug 26, 2013
    Posts:
    1,166
    Is there a reason that the Font Asset Creator doesn't just turn on the "readable" (which really means writable) flag when you have the Font Asset marked as Dynamic? Spamming the user for something that is only visible on a Debug Inspector seems a bit strange.