TextMeshPro 2.0.1 error
Hello, my fellow game devs!
I'm quite new in using TextMeshPro and so after a long and tedious fight with this package and his two mighty problems, I finally ask you for your's generous help.
First trouble is this big error message that now I'm seeing every time opening my project and also in my nightmares. After a long, painful and worthless solution-seeking I just give up on it, leaving as it is, because only trouble it makes - just bothering me, sitting in the console as an ugly weed in a beautiful garden of my debug's logs. But this hideous monstrosity may be the cause of the second and worse problem, so I put his text here:
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 <a8ed250850854b439cedc18931a314fe>:0)
System.Collections.Generic.Dictionary`2[TKey,TValue].Add (TKey key, TValue value) (at <a8ed250850854b439cedc18931a314fe>:0)
TMPro.TMP_FontAsset.InitializeDictionaryLookupTables () (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_FontAsset.cs:589)
TMPro.TMP_FontAsset.ReadFontAssetDefinition () (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_FontAsset.cs:607)
TMPro.TMP_FontAsset.get_characterLookupTable () (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMP_FontAsset.cs:139)
TMPro.TextMeshProUGUI.LoadFontAsset () (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMPro_UGUI_Private.cs:539)
TMPro.TextMeshProUGUI.OnValidate () (at Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMPro_UGUI_Private.cs:302)
And now, the second problem. This beast is stealing my time every time I open my future masterpiece to breath some life inside of it. Every time I start to work on my dream project one or more of many TextMeshProUGUI just stops displaying text carefully placed in it! The text is still inside the text window, but the inside scene and game view - nothing, like it were stolen by a ghost or some other supernatural thing. I thought the problem was inside SDF Material attached to the object, but, what a surprise, it also disappears like a bad father, when it goes to buy some cigarets and then never returns. The only solution I found for that - create a new TextMeshPro text object, but, as you might already guess, this is not permanent.
Thanks for your time and mind power to help me defeat this annoying duo. Also, I will provide additional information, but I do not know what type of information is needed and where to seek.
Have a nice day!
Answer by blastbeatsandcode · Dec 18, 2019 at 12:54 AM
I am not certain if this is helpful, and I am fairly inexperienced with TMPro myself, but when I ran into this issue I solved it by using a different Font Asset on the Text Mesh Pro UGUI
component. The REAL solution would be to fix the one you're using if it's the one you want to use in the end.
In my case, the font I was using was not generated in the Font Asset Creator properly.
Window
> TextMeshPro
> Font Asset Creator
I'm having the same issue, could you explain, what you mean by "the font I was using was not generated in the Font Asset Creator properly", I don't see, how you could make mistakes there.
Like I said, I'm not super familiar with how the fonts work with T$$anonymous$$Pro. I just know that some of the fonts I have tried to use with it work after I use the creator, and some don't. I have never created my own font and usually buy them or find them for free online when I use them.
Answer by arturgiardi · Feb 12, 2020 at 11:35 PM
I had the same problem today and did a few things:
I deleted all fonts assets that I created using Text Mesh Pro
Deleted all the .meta files related to the fonts assets and the font files used to create these fonts assets
I created the fonts again with Packing Mode equal to Optimum
I don't know exactly what caused this error to disappear, but this process worked for me. I hope it helps you too.
Answer by htq110219891 · Jun 09, 2020 at 08:54 PM
This post has a solution https://forum.unity.com/threads/help-getting-an-argumentexception-thrown-by-textmeshpro-ui-control.735821/
Your answer
Follow this Question
Related Questions
2018.2 text mesh pro. plugin Errors. 7 Answers
How do I make a TextMesh Pro Font Asset from a texture atlas? 0 Answers
Change TextMeshPro text frequently after time 0 Answers
Error CS1525 Unexpected Symbol "if" Pls help 1 Answer
OnGUI behind UI? 0 Answers