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

TextMesh Pro Version 1.4.1-Preview 1 with Dynamic SDF for Unity 2018.3 now available!

Discussion in 'UGUI & TextMesh Pro' started by Stephan_B, Jan 31, 2019.

  1. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,960
    If you are migrating a project from the Legacy (non package manager versions) you will need to carefully read / follow the instruction in the following sticky post just below this one to migrate your project to the new package manager version of TextMesh Pro.
     
  2. PJbigscreen

    PJbigscreen

    Joined:
    Jul 22, 2017
    Posts:
    14
    I'm still encountering the issue reported by others where text appears as blank or a white box on objects that are scaled up from 0. This is both in the case of uniform and non-uniform scaling. TextMesh Pro 1.4.1, Unity 2018.3.9f1

    The code changes suggested earlier in the thread to fix this appear to already be there in my current version of TM Pro.

    Any ideas?
     
  3. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,960
    Can you provide me with a simple repro project that would enable me to reproduce this behavior easily?

    If it is easier, you can submit a bug report with the included project. Be sure to include the steps to reproduce and the Case # once you have it.
     
  4. PJbigscreen

    PJbigscreen

    Joined:
    Jul 22, 2017
    Posts:
    14
    Will send the repro project via dropbox link in a just a bit.
     
  5. PJbigscreen

    PJbigscreen

    Joined:
    Jul 22, 2017
    Posts:
    14
  6. mdsitton

    mdsitton

    Joined:
    Jan 27, 2018
    Posts:
    36
    @Stephan_B I think i've found a couple of bugs with the dynamic sdf support. I have a reproduction project that causes a crash. The same code worked fine on unity 2018.4.2f1 but crashes on the latest 2018.4.9f1 and any newer unity versions including 2019.2.5f1

    Which to me suggests that there was a change with the unity side of things that broke this. Specifically something with
    FontEngine.TryAddGlyphsToTexture()

    Here is an image of what it looks like in unity 2018.4.2f1:

    dynamic-sdf-bugpng.png

    And this is the crash i get in 2018.4.9f1:


    NullReferenceException: Object reference not set to an instance of an object
    TMPro.TMP_FontAsset.TryAddCharacters (System.UInt32[] unicodes, System.UInt32[]& missingUnicodes) (at Library/PackageCache/com.unity.textmeshpro@1.4.1/Scripts/Runtime/TMP_FontAsset.cs:1093)
    DynamicSDFTest.LoadFontAsset (UnityEngine.Font sourceFont, System.UInt32[] characters, System.UInt32[]& missingGlphs) (at Assets/Scripts/DynamicSDFTest.cs:76)
    DynamicSDFTest.Start () (at Assets/Scripts/DynamicSDFTest.cs:33)


    There is also a second bug with TryAddCharacters not setting the missing glyph array output. Which i have a workaround in the reproduction project for now.(this bug is in 2018.4.2f1 at least don't know if it effects newer versions or not)

    Here is the download for the repro project: https://drive.google.com/file/d/1dOHd4_rzswiUDIaGWi46HvA8cMlRLv3u/view?usp=sharing

    What i'm doing is building several font assets entirely in code, setting up fallback font assets, and populating the needed characters.Then using them on the tmp ugui object in the scene
     
  7. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,960
    I'll take a look at these tomorrow.
     
  8. mh114

    mh114

    Joined:
    Nov 17, 2013
    Posts:
    291
    Hi @Stephan_B , are the different SDF generation modes documented somewhere? We have always used SDF16x, now I noticed there is the SDFAA which is really fast in comparison, and apparently was added for the dynamic font system. I was just wondering if there is any quality difference between them? Currently we are using just static fonts, so it probably makes sense to keep on using 16x generation, but nonetheless I'm still curious. :)
     
  9. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,960
    The SDF16 and SDF32 are very accurate but extremely slow in terms of generation. The SDFAA is not as accurate but fast enough to use for dynamic generation at runtime.

    The lower accuracy could be noticeable on text displayed at 80 point size or greater if it has an outline or shadow. So for big stylized titles, I would continue to use SDF16 or SDF32 but for anything else use the new modes.
     
    mh114 likes this.
  10. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    7,153
    mh114 likes this.
  11. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,960
    So many posts... forgot about that one. Thank you for referencing it again.

    P.S. Like I mentioned in some other previous post (somewhere o_O) I do plan on further improving the SDFAA when I have time.
     
  12. PJbigscreen

    PJbigscreen

    Joined:
    Jul 22, 2017
    Posts:
    14
    @Stephan_B Were you able to have a look at my repro project for the scaling issue?
     
  13. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,960
    Currently looking at it.

    The issue is related to the end state of the scale where it ends up being zero.

    Changing the following line to use a small value like 0.0001f will get around this issue.

    testText.transform.DOScale(new Vector3(testText.transform.localScale.x, 0.0001f, 0.0001f), 0.09f).SetEase(Ease.InBack).OnComplete(() => testText.SetActive(false));

    I will take a closer look to see if I can make the value of zero work.

    Update
    I was able to address the underlying issue where the original code will now behave as expected. The issue was related to the scale going negative due to the tweening.
     
    Last edited: Sep 19, 2019
  14. mdsitton

    mdsitton

    Joined:
    Jan 27, 2018
    Posts:
    36
    Any chance to look at my issue yet?
     
  15. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,960
    Looking at it next (later tonight / tomorrow)
     
  16. PJbigscreen

    PJbigscreen

    Joined:
    Jul 22, 2017
    Posts:
    14
    @Stephan_B Ok, great. Any chances you can post the necessary code changes to fix it?
     
  17. mdsitton

    mdsitton

    Joined:
    Jan 27, 2018
    Posts:
    36
    I hate to bug you too much about it, but the bug i posted is a fairly critical blocking bug for us. Where we have been planning to get a release out by the end of the month. Have you had the chance to take a look at it yet?
     
  18. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,960
    My apologies for the delay in looking at your report. I finally got a chance to download your reproduction project and as it turns out, it is something that I have already addressed in the next release. The issue is / was an oversight on my part related to an optimization that made it into the editor which impacted the current release.

    The solution to the issue is pretty simple and will require you make the following changes which I have already described in a the following thread.

    I made the code changes in your reproduction project and got the following output instead of the error.

    upload_2019-9-21_0-15-48.png

    Please make those changes and let me know if you run into any other issue. As usual, I'll be monitoring the forum over the weekend.

    P.S. These changes will be in the next package release which I am currently in the process of finalizing to release early next week.
     
    aurelien-morel-ubiant likes this.
  19. PJbigscreen

    PJbigscreen

    Joined:
    Jul 22, 2017
    Posts:
    14
    @Stephan_B Will you will including the fix to the negative scale bug in an upcoming update? Any chance you can let me know what code changes are necessary in advance of the release?
     
  20. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,960
    That fix will be included in the release.

    I did overcome the package publishing issue I ran into over the past few days (which I referenced in other posts). The plan is for one last day of testing on my end (tomorrow) and then pushing the new packages which will be version 1.5.0-preview.1 for Unity 2018.4 and 2.1.0-preview.1 for Unity 2019.x.
     
  21. IntegralAR

    IntegralAR

    Joined:
    Dec 12, 2019
    Posts:
    1
    So are there any updates on the progress of the integration withUnity’s Addressables System? Having a simple and more reliable solution for dynamic text updates for any application is almost necessary since Unity claims anything published after 2019 should use the Addressables system!
     
  22. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,960
    What do you mean by "Having a simple and more reliable solution for dynamic text updates"?

    The new Dynamic SDF system introduced in version 1.4.x combined with the added Multi Atlas Texture support added in 1.5.x should provide for all the flexibility needed to handle dynamic text updates.
     
  23. yourlove_dlc

    yourlove_dlc

    Joined:
    Jan 9, 2019
    Posts:
    1
    The font atlastexture generated is only 4m(2048 X2048). On Android mobile phones, there is 16m in profiler. Do you know why? texture format converted to RBGA?
     
  24. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,960
    The Atlas Texture should remain 8 Bit Alpha ... check build compression / texture settings.
     
  25. martingonzalezetermax

    martingonzalezetermax

    Joined:
    Dec 11, 2017
    Posts:
    24
  26. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,960
    martingonzalezetermax likes this.
  27. martingonzalezetermax

    martingonzalezetermax

    Joined:
    Dec 11, 2017
    Posts:
    24
    Is it possible that version 1.5.0-preview.8 uses NET 4.x System.Diagnostic.Contracts? If yes, it's breaking retrocompatibility with NET 3.5
     
    BalDev likes this.
  28. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,960
    I switched over to using Rider where I have noticed it is adding System.Diagnostic.Contracts ... which is annoying and should not be happening.

    I will make sure those are removed in the next update. However, since .Net 3.5 was deprecated in 2018.4, we will all need to migrate to .Net 4.x for 2019.x.
     
    BalDev and martingonzalezetermax like this.
  29. doraemon213

    doraemon213

    Joined:
    Feb 10, 2013
    Posts:
    3
    I'm not familiar with the tech... I wonder if we could use dynamic font, is there any reason to NOT use it and use static font instead? It seems to be a lot more convenient to use. Specifically would it hurt performance on mobile?
     
  30. Stephan_B

    Stephan_B

    Unity Technologies

    Joined:
    Feb 26, 2017
    Posts:
    4,960
    Using a combination of static and dynamic font assets is the recommended workflow.

    You would use static font assets where these would include all the known characters used in the project for any given language or groups of languages.

    For user input / unknown characters, you would create dynamic font assets that would be assigned as fallback to your primary static font assets.

    In terms of using dynamic font assets to handle user input at runtime, the performance is such that none of this would be noticeable by users.

    See the following post and links along with the following updated videos.



     
unityunity