Search Unity

Question It is possible using 'Atlas Population Mode: Static' Font Asset for UITK's Text Input Field?

Discussion in 'UI Toolkit' started by engcraft, Sep 1, 2022.

  1. engcraft

    engcraft

    Joined:
    Aug 17, 2022
    Posts:
    8
    I generated Korean font asset by Windows > Font > Font Asset Creator and applied it to ui toolkit's text input field. (Cuz I knew that TMP Font Asset is unable to use for UITK.)

    But, In Play mode, i cannot input any character (english, number, korean...) in Text Field.
    So i change atlas population mode, Static to Dynamic, then it works properly.

    Q1. How to use Static Font Asset for UITK's text field? Is it impossible?
    Q2. If i use Dynamic font asset for project, is there any performance penalty compared to Static?
    Q3. Is there a performance's difference between Static and Dynamic Mode?
    Q4. After i use Dynamic font asset for project and build it -> dynamic font asset changed. Then, what happened on device that program installed? Generate garbage memory? Or deleted periodically?

    Thank you for reading.
     
    Last edited: Sep 1, 2022
  2. HugoBD-Unity

    HugoBD-Unity

    Unity Technologies

    Joined:
    May 14, 2018
    Posts:
    499
    Hello!

    Static FontAsset is supported, but they need to be prepopulated. Here's how:
    • Open the FontAssetCreator.
    • Only include the characters that are needed (see Character Set Forum Post)
    • Keep in mind that your sampling to padding ratio should stay 1:10.
    • Once all settings are fine, you can play around with the different Rendering Modes. SDFAA is the fastest, but also the less precise. SDF32 is extremely slow to rasterize, but it gives the best result.

    Static FontAssets are the most performant as you are baking the atlas with the characters you need in advance. It is also more memory efficient as the source font file won't be exported to the player.

    Dynamic FontAssets are typically used for InputFields where you canèt know in advance which characters will be displayed as they are coming from a user input.

    We are currently in the process of adding documentation for all of this. In the meantime here's some TMP documentation that should still be relevant.
     
  3. engcraft

    engcraft

    Joined:
    Aug 17, 2022
    Posts:
    8
    Thanks for the detailed reply, i really appreciate it!!