Search Unity

  1. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice
  2. Ever participated in one our Game Jams? Want pointers on your project? Our Evangelists will be available on Friday to give feedback. Come share your games with us!
    Dismiss Notice

TextMesh Pro always reimport the fonts (setup kerning values)

Discussion in 'UGUI & TextMesh Pro' started by studentutu, Aug 9, 2019.

  1. studentutu

    studentutu

    Joined:
    Oct 22, 2017
    Posts:
    74
    Good afternoon everyone,
    I have a problem :
    Unity 2019.2.0f1, TextMesh Pro 2.0.1
    Each time I open the Unity Editod TextMesh Pro always reimport the fonts (setup kerning values)

    Please, Help! It takes almost ten minutes just to start the editor now!

    upload_2019-8-9_14-10-13.png
     
  2. studentutu

    studentutu

    Joined:
    Oct 22, 2017
    Posts:
    74
    Need to test - but it seems if you make a dynamic font both in TextMeshProAsset and the font itself - the problem seems to be gone.... Please, need your advice!
     
  3. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,325
    The above message "Hold on..." and importing of kerning values comes from the Unity Font Importer and not TextMesh Pro.

    I am not sure why this message would keep re-appearing. What were the settings of that particular font in the Font Importer?
     
  4. studentutu

    studentutu

    Joined:
    Oct 22, 2017
    Posts:
    74
    I figured it out - I switched to new Unity 2019.2 with old package (simply deleted library and fixed the version in project version) - you need to download latest TextMesh Pro - and reimport the essential tools!
     
  5. Amoo0001

    Amoo0001

    Joined:
    Mar 7, 2019
    Posts:
    9
    I have this problem too, in 2019.2.17f1.

    Nearly every time Unity rebuilds in-editor (which is quite often, as this happens every time I change a script!), it says "Hold on..." and "Setting up kerning values for font 'Arial'", then"Hold on..." and "Setting up kerning values for font 'Liberation Sans'" (I typed the messages in full to help people find this post from Google). This process takes approximately 2 minutes for me, but happens most times I change any script or do anything to cause Unity to rebuild.

    I agree with Stephan_B and don't think this has anything to do with TextMesh Pro, as the fonts that are causing these messages are a different set of fonts than what I use in TMP. The dialogue also matches the other Unity built-in dialogue boxes, such as "Importing small assets." rather than those of TextMesh Pro.

    I can confirm that deleting Library and letting Unity regenerate it seems to have fixed this problem. I will reply again if the issue comes back up. I hope my input helps anyone who might have stumbled onto this post with the same issue.

    Unity_rcE1ThKuJg.png
     
    nischita likes this.
  6. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,325
    Thank you for sharing this information.

    I'll ask around to see what might have changed on the import side that would cause this new behavior.
     
  7. Amoo0001

    Amoo0001

    Joined:
    Mar 7, 2019
    Posts:
    9
    No problem, and thank you for looking into it :)

    The issue was gone for the rest of the day yesterday after I let Unity regenerate Library, but it came back today. Let me know if there is anything I can do to help.
     
  8. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,325
    I need to figure out a way to reproduce the behavior. Something is causing this re-import on the Unity side but not sure what.

    Can you submit a bug report and include a project that will enable me to reproduce the behavior?
     
  9. Amoo0001

    Amoo0001

    Joined:
    Mar 7, 2019
    Posts:
    9
    Ok. My current laptop is out of disk space so I can't dupe my project for a repro project until my new one gets here (in a few days), but then if all goes well I will minimize my project and submit it in a bug report as a repro project within a few days. I'll reply here when I do or if I run into trouble.
     
  10. Amoo0001

    Amoo0001

    Joined:
    Mar 7, 2019
    Posts:
    9
    My new computer got here today but I haven't made the repro project yet. However, I did find out some more information which I think could be helpful.

    First, the reimport dialogues begin with an "Importing small assets." dialog that flashes quickly.

    Second, there are at least two more fonts that are being reimported: Bebas and Open Sans. Their dialogue boxes flash by really quickly, especially Bebas. I had to screen capture and frame-by-frame in order to see what font it was. The order is Bebas, Arial, Open Sans, and then Liberation Sans.

    Third, sometimes the reimport happens just by leaving play mode with no script changes.

    And finally and most significantly, if I try to save while the reimport is still happening, I get a Unity-internal exception with a stack trace. I will attach screenshots of the exception and the code line that throws it. It is in the LWRP code in a static method called ReimportAllMaterials, and I am indeed using LWRP (and the experimental 2D renderer), so take that as you will. I hope this helps and I still plan to make a repro project as soon as I get a chance.

    vlc_ofgffmyfTV.png AnqFj7Sw5q.png devenv_nyj64cBmLW.png
     
  11. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,325
    Good find and very interesting :confused:

    I would strongly suggest submitting a bug report as this is something the Graphics team (those handling SRP) should take a look at.
     
  12. eTech3D

    eTech3D

    Joined:
    Feb 2, 2014
    Posts:
    18
  13. eTech3D

    eTech3D

    Joined:
    Feb 2, 2014
    Posts:
    18
    Hi,
    I want to submit a bug report, but my project is huge (3 GB), is there any other way?
     
  14. Amoo0001

    Amoo0001

    Joined:
    Mar 7, 2019
    Posts:
    9
    That's the reason why I haven't submitted a bug report yet either. However, I may have just solved this. Here is the relevant Unity-internal code:

    Code (CSharp):
    1.     class MaterialReimporter : Editor
    2.     {
    3.         const string Key = "LWRP-material-upgrader";
    4.      
    5.         [InitializeOnLoadMethod]
    6.         static void ReimportAllMaterials()
    7.         {
    8.             //Check to see if the upgrader has been run for this project/LWRP version
    9.             PackageManager.PackageInfo lwrpInfo = PackageManager.PackageInfo.FindForAssembly(Assembly.GetAssembly(typeof(LightweightRenderPipeline)));
    10.             var lwrpVersion = lwrpInfo.version;
    11.             var curUpgradeVersion = PlayerPrefs.GetString(Key);
    12.  
    13.             if (curUpgradeVersion != lwrpVersion)
    14.             {
    15.                 string[] guids = AssetDatabase.FindAssets("t:material", null);
    16.  
    17.                 foreach (var asset in guids)
    18.                 {
    19.                     var path = AssetDatabase.GUIDToAssetPath(asset);
    20.                     AssetDatabase.ImportAsset(path);
    21.                 }
    22.                 PlayerPrefs.SetString(Key, lwrpVersion);
    23.             }
    24.         }
    25.     }
    Note that it checks PlayerPrefs to see if it needs to update. In my code, I am clearing PlayerPrefs every time the game starts in the editor with PlayerPrefs.DeleteAll(); therefore, it always thinks it is out of date.
     
    eTech3D likes this.
  15. Amoo0001

    Amoo0001

    Joined:
    Mar 7, 2019
    Posts:
    9
    The spam filter is preventing me from editing my previous message, saying my edit is "spam like". Please read "starts in the editor" as "runs while in Unity Editor".
     
  16. eTech3D

    eTech3D

    Joined:
    Feb 2, 2014
    Posts:
    18
    Me too, I think that's the reason...If I deactivate PlayerPrefs.DeleteAll() in the editor, it seems no more annoying reimporting heppening.
    Thank you for the find
     
    Amoo0001 and Stephan_B like this.
  17. Amoo0001

    Amoo0001

    Joined:
    Mar 7, 2019
    Posts:
    9
    No problem, I'm glad that fixed it for you too. I also haven't had the annoying reimport since removing PlayerPrefs.DeleteAll() from my startup code either.

    Stephan_B, should I still file a bug report? It's not exactly intuitive or expected that LWRP is using PlayerPrefs internally, but I'm not sure this counts as a bug anymore. Now that I know what was causing this to happen, it should be much easier to make a repro project from scratch instead of having to strip down my game.
     
  18. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,325
    I would still suggest submitting a bug report with repro project if possible but for certain pointing to this thread for the QA folks to review.

    Make sure to identify the issue as being related to LWRP and the use of PlayerPrefs.
     
  19. Amoo0001

    Amoo0001

    Joined:
    Mar 7, 2019
    Posts:
    9
  20. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,325
unityunity