Search Unity

TextMesh Pro TextMeshPro 1.4.1 TryAddCharacters exception if string contains both space and non breaking space

Discussion in 'UGUI & TextMesh Pro' started by DavidZhongIGG, Dec 19, 2019.

  1. DavidZhongIGG

    DavidZhongIGG

    Joined:
    Apr 30, 2019
    Posts:
    7
    After creating a font, there will be an argument exception if you call TryAddCharacters(" \u00a0")

    ArgumentException: An item with the same key has already been added. Key: 3
    System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <df7127ba07dc446d9f5831a0ec7b1d63>:0)
    System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at <df7127ba07dc446d9f5831a0ec7b1d63>:0)
    TMPro.TMP_FontAsset.TryAddCharacters (System.String characters, System.String& missingCharacters) (at Library/PackageCache/com.unity.textmeshpro@1.4.1/Scripts/Runtime/TMP_FontAsset.cs:1246)
    TMPro.TMP_FontAsset.TryAddCharacters (System.String characters) (at Library/PackageCache/com.unity.textmeshpro@1.4.1/Scripts/Runtime/TMP_FontAsset.cs:1144)
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Please try the latest release which is version 1.5.0-preview.3 for Unity 2018.4.