Search Unity

[Solved] My little story trying to use TextMeshPro with Unity 2019.2

Discussion in 'UGUI & TextMesh Pro' started by Erenquin, Jan 26, 2020.

  1. Erenquin

    Erenquin

    Joined:
    Apr 9, 2018
    Posts:
    164
    Goal is to display a score.

    Installation via Package manager and display setup are ok, then ...

    At each steps I try to close / re-open Unity and Visual Studio

    1) Try to access the text element via script.
    using TMPro; -> can't find namespace.
    Search google: need to use .Net 4 and Visual Studio 15.7 -> ok checked.
    Still TMPro is not recognized.

    2) Remove TextMeshPro from the packages, add it from the Asset Store.
    Now the TMPro namespace is recognized and I can implement the scoring system.
    Everything is working well. Yeah.

    3) Now is time for some unit tests.
    Open test script.
    using TMPro; -> can't find namespace.
    Think about adding the TMPro assembly to the references (confirmed in a post I found), but the TextMeshPro from Asset store does not have one.

    4) Remove TextMeshPro (Asset store version) and re-download the one from the package manager.
    Indeed this version can be added to the assembley reference (but in the implementation the namespace is not recognized).

    5) Update Unity to a newer version (2019.2.13f1 to 2019.2.19f1).
    No change, except that it does not recognized my tests (not related to TextMeshPro).
    After several restarts, the tests were magically recognized.

    Up to this point I lost a good 4 hours, maybe even 5.

    6) Revert all this mess (remove TextMeshPro, revert to 2019.2.13f1)
    Using the standard Text UI component.
    20 minutes later everything is running well.

    Conclusion:
    TextMeshPro is not 2019.2 verified as mentioned in the package manager.
    It was probably working at the time of release, and I saw video showing it (which is why I decided to use it), but it is not any more.
     
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Sorry to hear that you had some issues trying to use TMP in Unity 2019.x. Below is feedback on some of your reports.

    The only version of TextMesh Pro that should be used with Unity 2018.4 or newer is the Package Manager versions of TMP. The Asset Store version remains available for users of previous versions of Unity.

    Starting with Unity 2018.4, TextMesh Pro is a default package that is included with the Editor. So no additional steps are required to use TMP other than importing the TMP Essential Resources and optional but still recommended TMP Examples & Extras.

    The .Net 4 requirements have been removed with subsequent versions of the TMP package including version 2.1.0-preview.3 which is the latest available for Unity 2019.x.

    I would suggest creating a new project in 2019.2. Then import the TMP Essential Resources and TMP Examples & Extras by going to the Window - TextMeshPro - Import ... options in that menu.

    Once those resources have been imported, try out any of the Scenes included in the Examples folder. The above should all work as expected. Let me know if that is not the case.

    In terms of using Unit Tests, special steps must be followed as a result of packages all using .asmdefs. See the following.
     
  3. Erenquin

    Erenquin

    Joined:
    Apr 9, 2018
    Posts:
    164
    Thanks for the answer, much appreciated.

    Regarding using the Asset Store version I thought so, it was to try it out and also confirm my logic.

    I must apologize though, as this morning I figured out that I had to add the TexMespro in the assembly of the application.
    As I mentioned in my post, I thought about adding it in the unit test assembly but not in the main application.
    After that, I could import the namespace normally.

    Yet, there is still a huge bug.
    I will create a new post to describe it.
    Short story: the text component is not updated if referenced externally.

    See this post:
    https://forum.unity.com/threads/tex...-not-updated-if-referenced-externally.818100/

    That's another almost 2 hours lost trying to use TextMeshPro.
    I will stop that for now and eventually try it for the next one, with maybe an LTS version of Unity.
     
    Last edited: Jan 29, 2020
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    See my reply to your external reference post.