Search Unity

TextMesh Pro Text Mesh Pro Dozens of errors with Unity 2019.1

Discussion in 'Unity UI (uGUI) & TextMesh Pro' started by MikeUpchat, Apr 16, 2019.

  1. Enzi

    Enzi

    Joined:
    Jan 28, 2013
    Posts:
    199
    Thanks for the step-by-step guide David!
    I'd just like to add that if you have any references to TMPro from code, I had to remove them ALL otherwise the build process wasn't able to finish and I was still stuck with the Task error.
    After removing the references the build process finished and I could import essentials and fix the missing fonts with the remapping tool.
     
  2. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,175
    Going from Legacy version of TMP (ie. 2017 and earlier) to 2019 is a massive step.
     
  3. viktorzb97

    viktorzb97

    Joined:
    Dec 21, 2017
    Posts:
    2
    This fix the problem for me thanks.
     
  4. Raubi

    Raubi

    Joined:
    Apr 3, 2015
    Posts:
    7
    Hi @Stephan_B

    as mentioned in the other thread, this error is still persistent on my project.

    It was a Unity 2018.3 project, which has been upgraded to Unity 2019.1.2f1. I still get the error (TextMesh Pro 2.0.1):

    Code (CSharp):
    1.  
    2. Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Editor/TMP_SettingsEditor.cs(332,91): error CS0407: 'Object TMP_ResourceImporterProvider.GetTMPSettings()' has the wrong return type
    3.  
    The project has been on .NET 4.x runtime since beginning. Fun fact: If I remove the Library folder, I can build the project exactly once, after that the error appears again. Or, if I remove the Library folder, open the project and switch to another platform, then the error appears as well.

    I can not build the project on Unity Cloud Build as well, get the same error there.

    I'd be happy to hand over the project to you, if you want to take a closer look.

    However, I do not get the error, if I create a new project with Unity 2019.1 and update to TextMeshPro 2.0.1
     
    Last edited: May 14, 2019
  5. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,175
    Please submit a bug report with the included project and the steps to reproduce the error. Please provide me with the case # once you have it.
     
  6. Raubi

    Raubi

    Joined:
    Apr 3, 2015
    Posts:
    7
    Case 1153646. Submitted that one 3 days ago, with 2.0.1-preview of TextMesh Pro. If you need the current project with update to 2.0.1-release, I can provide that as well.
     
  7. ReaktorDave

    ReaktorDave

    Joined:
    May 8, 2014
    Posts:
    105
    Can confirm this issue and the workaround with Bolt 1.4.3f2 and Unity 2019.1.2f1.
     
  8. ImbaGame

    ImbaGame

    Joined:
    Jan 29, 2015
    Posts:
    11
    I confirm this too. Can use 1.3.0 to workaround
     
  9. zhollis21

    zhollis21

    Joined:
    May 28, 2018
    Posts:
    2

    Changing the project settings to use .Net 4 fixed the issue for me!
     
    Stephan_B likes this.
  10. hellfull

    hellfull

    Joined:
    Dec 11, 2015
    Posts:
    1
    That worked. Thanks a lot
     
    Stephan_B likes this.
  11. colorurlife2013

    colorurlife2013

    Joined:
    Jun 7, 2019
    Posts:
    1

    Thanks for this solution. I tried all the changes in the new 2019 version but the above steps worked out absolutely fine.
     
  12. Paul_Bronowski

    Paul_Bronowski

    Joined:
    Sep 3, 2014
    Posts:
    53
    I can repro on Unity 2018.4.2f1. TMPro has a bug and I'll file a bug report with them.

    This is a textbook case for why C# implicit variable typing is troublesome. The compiler is having difficulty inferring which overload to use and is picking the wrong one. Note the optional 'keywords' parameter - the default value not being documented at https://docs.unity3d.com/ScriptReference/AssetSettingsProvider-ctor.html ...

    public AssetSettingsProvider(string settingsWindowPath, Func<Editor> editorCreator, IEnumerable<string> keywords = null);
    public AssetSettingsProvider(string settingsWindowPath, Func<Object> settingsGetter);

    In Library\PackageCache\com.unity.textmeshpro@1.4.1\Scripts\Editor\TMP_SettingsEditor.cs

    This...

    Code (CSharp):
    1.         [SettingsProviderGroup]
    2.         static SettingsProvider[] CreateTMPSettingsProvider()
    3.         {
    4.             var providers = new List<SettingsProvider> { new TMP_ResourceImporterProvider() };
    5.  
    6.             if (GetTMPSettings() != null)
    7.             {
    8.                 var provider = new AssetSettingsProvider("Project/TextMesh Pro/Settings", GetTMPSettings);
    9.                 provider.PopulateSearchKeywordsFromGUIContentProperties<TMP_SettingsEditor.Styles>();
    10.                 providers.Add(provider);
    11.             }
    12.  
    13.             return providers.ToArray();
    14.         }
    Needs to be something like this...

    Code (CSharp):
    1.         [SettingsProviderGroup]
    2.         static SettingsProvider[] CreateTMPSettingsProvider()
    3.         {
    4.             List<SettingsProvider> providers = new List<SettingsProvider> { new TMP_ResourceImporterProvider() as SettingsProvider };
    5.  
    6.             UnityEngine.Object tmpSettingsObj = GetTMPSettings();
    7.             if (tmpSettingsObj != null)
    8.             {
    9.                 AssetSettingsProvider provider = AssetSettingsProvider.CreateProviderFromObject("Project/TextMesh Pro/Settings", tmpSettingsObj);
    10.                 provider.PopulateSearchKeywordsFromGUIContentProperties<TMP_SettingsEditor.Styles>();
    11.                 providers.Add(provider);
    12.             }
    13.  
    14.             return providers.ToArray();
    15.         }
    But the class TMP_ResourceImporterProvider could also probably be changed to derive from AssetSettingsProvider instead of SettingsProvider. See the AssetSettingsProvider docs for sample usage.
     
  13. Paul_Bronowski

    Paul_Bronowski

    Joined:
    Sep 3, 2014
    Posts:
    53
  14. kk99

    kk99

    Joined:
    Nov 5, 2013
    Posts:
    77
    I have the same issue. Deleting the PackageCache solves it temporally. but if you reload the Project you have the error again.

    Apparently you must not use the Text Mesh Pro from the Asset Store because it will always lead to this Cache problem.

    as davidruizBambo mentioned. Go to Window->TextMeshPro->Import TMP Essential Resources

    the other steps I didnt need to do.


    Attention!
    However, this will lead to MISSING SCRIPTS in your entire Project. because this Text Mesh Pro will not recognize your prefabs etc.
     
  15. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,175
    With Unity 2018.1 and up, you should migrate to the Package Manager version of TextMesh Pro. The Asset Store version is considered the Legacy version and is no longer getting updated. Be sure to review and following the migration instructions in the sticky post in this forum section.

    As far as these errors, they are due to version 1.4.0 using .Net 4.x. However, I reverted this change in version 1.4.1. Using .Net 4.x is still required for version 2.0.x of the TMP package.
     
  16. enginx3d

    enginx3d

    Joined:
    Aug 15, 2015
    Posts:
    1
  17. MythicalCity

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    387
    I'm also getting the task error with the both the preview and non-preview version of 2.0.1 with .net 4. I tried everything on this thread (deleting the packages, importing, etc) and the only thing that worked was reverting back to 1.4
     
  18. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,175
    Are you using the Bolt plugin? This issue seems to be related to that.

    Make sure you delete the Global package cache which on windows is located in "...\AppData\Local\Unity Cache\cache"
     
  19. MythicalCity

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    387
    Yes, I deleted both the global and library cache. No I'm not using Bolt, but have several other plugins including networking ones that might have their own threading namespace. Still, the error is in text mesh pro's use of the task namespace.
     
  20. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,175
    and you did upgrade the Scripting Runtime to use .Net 4.x?

    Just for fun, create a new empty project with just TMP to see if you get the same behavior.
     
  21. MythicalCity

    MythicalCity

    Joined:
    Feb 10, 2011
    Posts:
    387
    Yes, I used .net 4 and all of the other suggestions on this thread.

    If I get a chance I'll try out a new project.
     
  22. KingKong320

    KingKong320

    Joined:
    Mar 2, 2018
    Posts:
    20
    Since this is marked solved without an explanation, I'll list my fix in case anyone else sees this. I went to Project Settings>Player>Other Settings>Configuration and changed Scripting Runtime Version to .NET 4.x Equivalent, then restarted Unity.
     
  23. jdscogin

    jdscogin

    Joined:
    Oct 26, 2014
    Posts:
    61
    This worked Great! Thanks.
     
  24. geganadiradze

    geganadiradze

    Joined:
    Sep 23, 2017
    Posts:
    8
    New project has no errors, but with my old project I can't fix this "The type 'Task' exists in both" error, tried everything listed in this thread, but for some reason downgrade of TMP isn't possible it's just greyed out...
    I'm also using github for unity, maybe that might be related as well Idk...
    EDIT:
    Also "Window->Textmesh Pro" submenu doesn't exist when I'm in updated project, but it does exist if I create new project, so that's odd as well
     
    Last edited: Jul 14, 2019
  25. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,175
    Did you switch the Scripting Runtime to .Net 4.x?
     
  26. geganadiradze

    geganadiradze

    Joined:
    Sep 23, 2017
    Posts:
    8
    Yes, switching to .Net 4.x fixed most of the problems but that "Task" case wasn't resolved...
    There's no actual requirements for me to use 2019, so I'm going to stick with 2018 LTS for this project.
     
  27. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,175
    Do you have the Bolt plugin in the project?
     
  28. geganadiradze

    geganadiradze

    Joined:
    Sep 23, 2017
    Posts:
    8
    Nope
     
  29. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,175
    Can you submit a bug report that includes the project that is displaying this error? I would like to take a look.
     
  30. geganadiradze

    geganadiradze

    Joined:
    Sep 23, 2017
    Posts:
    8
    Looks like it was a problem with github for unity plugin, it works fine without it
     
  31. bhavinbhai2707

    bhavinbhai2707

    Joined:
    Jan 4, 2017
    Posts:
    5
    This solutions works for the people having "Feature `out variable declaration' cannot be used because it is not part of the C# 4.0 language specification" Error.
     
  32. chaya1994

    chaya1994

    Joined:
    Jun 3, 2019
    Posts:
    1
    changing the 4.0 helped me as well! :)
     
  33. Reedex

    Reedex

    Joined:
    Sep 20, 2016
    Posts:
    265
    did you figure it out?
     
  34. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    3,175
    Are you having the same issue?

    What platform are you targeting in Build Settings?

    Are you getting this issue in a new empty project?
     
  35. JohnEvelyn

    JohnEvelyn

    Joined:
    Oct 28, 2016
    Posts:
    8

    I've been wrestling with this problem all day so far. Any suggestions would be greatly appreciated!

    I need to migrate a 2017.3.1f1 project to 2019.2.4f1.
    It uses TextMeshPro extensively - loads of classes make reference to it.

    Every approach to migrating I've tried results in the following error, which breaks the whole project:

    Library\PackageCache\com.unity.textmeshpro@2.0.1\Scripts\Editor\TMP_PackageUtilities.cs(310,17): error CS0433: The type 'Task' exists in both 'System.Threading, Version=1.0.2856.102, Culture=neutral, PublicKeyToken=31bf3856ad364e35' and 'mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'

    I followed the quoted steps and was able to migrate from 2017.3.1f1 to 2018.4.8.f1 successfully.

    BUT

    If I follow the same steps to move to 2019 I'm haunted by that error message up there ^. I can't proceed beyond step 7...as TextMeshPro doesn't compile/initialise at all.
    I have also tried migrating 1st from 2017 -> 2018 (ensuring it's all stable) then taking that on to 2019 and still the error persists in 2019.

    I'm really stuck at the mo, and unfortunately I -have to- take this project to 2019 for biz reasons.

    any ideas?
     
  36. Reedex

    Reedex

    Joined:
    Sep 20, 2016
    Posts:
    265
    i was told to go to (not sure if right steps)
    Windows>PackageManager>TextMeshPro>Uninstal(remove)package and then install it again(or not dont remember)
    but errors went poof.
    but i also didnt fully migrate, i just checked if its allright...
     
  37. JohnEvelyn

    JohnEvelyn

    Joined:
    Oct 28, 2016
    Posts:
    8
    Thank you for the suggestion but sadly uninstalling the TMPro package causes the error to disappear but then reinstalling it via the package manager brings it right on back!
     
  38. JohnEvelyn

    JohnEvelyn

    Joined:
    Oct 28, 2016
    Posts:
    8
    Ok, I found the culprit! Whoop!
    So, there was a conflict between the threading functionality in TMPro and a dependency in my project that was left over from some really icky early code a freelancer bunged in - it's been a long and arduous process unpicking and removing that mess...nearly there though!
     
  39. Reedex

    Reedex

    Joined:
    Sep 20, 2016
    Posts:
    265
  40. JohnEvelyn

    JohnEvelyn

    Joined:
    Oct 28, 2016
    Posts:
    8
    Reedex likes this.