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.

2019.3.0f6, TMP 2.0.1. Errors during fallback font asset atlas texture update

Discussion in 'UGUI & TextMesh Pro' started by ByMedion, Jul 29, 2020.

  1. ByMedion

    ByMedion

    Joined:
    May 10, 2018
    Posts:
    19
    Hello! I'm ran into issue when fallback font atlas texture updating throws error:

    ArgumentException: An item with the same key has already been added. Key: 0
    System.Collections.Generic.Dictionary`2[TKey,TValue].TryInsert (TKey key, TValue value, System.Collections.Generic.InsertionBehavior behavior) (at <437ba245d8404784b9fbab9b439ac908>:0)
    System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at <437ba245d8404784b9fbab9b439ac908>:0)
    TMPro.TMP_FontAsset.InitializeDictionaryLookupTables () (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_FontAsset.cs:589)

    Also, after this error, i have error in play mode:
    NullReferenceException: Object reference not set to an instance of an object
    TMPro.TextMeshProUGUI.UpdateSDFScale (System.Single scaleDelta) (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMPro_UGUI_Private.cs:4264)

    1. Save my new atlas
    2. Right after step 1
    3. After entering play mode, the following 170+ errors are identical Untitled.png
     
  2. ByMedion

    ByMedion

    Joined:
    May 10, 2018
    Posts:
    19
    Full errors message
     

    Attached Files:

    • Log.txt
      File size:
      6.9 KB
      Views:
      170
  3. ByMedion

    ByMedion

    Joined:
    May 10, 2018
    Posts:
    19
    So, i changed this line (589 in TMP_FontAsset.cs in PackageCache) from
    Code (CSharp):
    1. m_FontFeatureTable.m_GlyphPairAdjustmentRecordLookupDictionary.Add(key, record);
    to
    Code (CSharp):
    1. m_FontFeatureTable.m_GlyphPairAdjustmentRecordLookupDictionary[key] = record;
    and after that it started working but i have to do this modification every time when cache updated.

    Perhaps this information will be useful.
     
  4. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    6,588
    Please update to the latest release of the TMP package for Unity 2019.x which is version 2.1.1.

    Please let me know if the error persists.