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.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

TextMesh Pro Bug: KeyNotFoundException when using ellipsis, truncate with fallback font

Discussion in 'UGUI & TextMesh Pro' started by MarconiusDMM, Mar 11, 2020.

  1. MarconiusDMM

    MarconiusDMM

    Joined:
    Nov 24, 2017
    Posts:
    11
    Getting the following error:
    This is with 2.1.0-preview7.
    It only seems to happen with fallback fonts, and only if I have overflow mode set to Ellipsis or Truncate, and it actually tries to overflow. Works fine with my main font; also works fine if mode is simply Overflow.
     
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Could you please provide some reproduction project / scene for me to look at as this behavior will be very dependent on the text used, font asset and RectTransform width, etc.

    It should be a trivial fix once I am able to reproduce it.
     
  3. MarconiusDMM

    MarconiusDMM

    Joined:
    Nov 24, 2017
    Posts:
    11
    Hey,

    I think it only happens when the main font I want to use doesn't have the characters for ellipses in it (which is not that unusual for Asian fonts, for example). So it tries to fall back to a different font that does, but that fails. If I put in the fallback font directly, it works.

    Here's some sample fonts:
    https://mega.nz/#!yYBzGSaJ!0B-Eopq3p0L_K1N0ERxEhpkcOCm37g-5-kXJVyDblD0
    I basically have a Static font that falls back on a Dynamic font (they look the same, but different character tables). The Static one causes the error; the Dynamic one used directly works.
     
  4. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    As it turns out the issue is related to the End of Text \u0003 character which is an Ignorable / synthesized character which unfortunately was not getting added to existing font assets.

    This will be fixed in Preview 8 which should be available over the weekend.
     
  5. MarconiusDMM

    MarconiusDMM

    Joined:
    Nov 24, 2017
    Posts:
    11
    Awesome!
    Will this require existing font assets to be updated in some way?
     
  6. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    It will not require any changes to font assets.

    I have also made an additional change where in the event Text Overflow Ellipsis mode is selected with no Ellipsis character available, a warning will be issues and Text Overflow mode switched to Truncate instead.
     
  7. MarconiusDMM

    MarconiusDMM

    Joined:
    Nov 24, 2017
    Posts:
    11
    This seems to work good with preview8 now.
     
    Stephan_B likes this.