Search Unity

TextMesh Pro Can't reference Text Mesh Pro files from an Assembly made with Assembly Definition

Discussion in 'UGUI & TextMesh Pro' started by Rodolphito, Apr 14, 2018.

  1. Rodolphito

    Rodolphito

    Joined:
    Jan 31, 2014
    Posts:
    17
    Hello, I want to have a section of my code that I don't change often inside an assembly definition, but the problem is that it references Text Mesh Pro classes. Specifically, it is a GUI wrapper that makes GUI creation easier, with tons of helper functions. (It is a big file, thats why I want to have a separate assembly.)

    The problem is that I can't convince Unity to recognize the references to Text Mesh Pro, theres no way to select TMPro as a dependency in the dependency list.

    I am using Unity 2018.1b13, with Package-version TMPro.

    How can I do this?
     
    Last edited: Apr 14, 2018
    k72dragon and kamran-bigdely like this.
  2. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    See the following post.

    In short, you need to edit your .asmdef to manually add a reference to the Unity.TextMeshPro assembly for the runtime and Unity.TextMeshPro.Editor for the Editor one.
     
  3. Rodolphito

    Rodolphito

    Joined:
    Jan 31, 2014
    Posts:
    17
    Works fantastic, thanks! Sorry for the redundant post, I was sure that I had checked everywhere :/
     
  4. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Glad it is working :)
     
  5. hexagonius

    hexagonius

    Joined:
    Mar 26, 2013
    Posts:
    98
    @Stephan_B I ran into trouble with Unity 2018.2.6f1 and TMP 1.2.4. Even though I manually added the Unity.TextMeshPro assembly to my ASMDEF, TextMeshProUGUI and TMP_CharacterInfo cannot be found. Unity.TextMeshPro.Editor is unnecessary as it does not change anyhing.

    Furthermore, the location you posted in the other thread does not inherit any TMP related packages

    PackageManagerAndExplorerFolder.PNG

    What assembly do TextMeshProUGUI and TMP_CharacterInfo belong to and how can I find those if such a situation arises for other missing assemblies?
     
  6. Stephan_B

    Stephan_B

    Joined:
    Feb 26, 2017
    Posts:
    6,595
    Just double checked and on Windows, the location of the package is : "C:\Users\UserName\AppData\Local\Unity\cache\packages\packages.unity.com" and creating a new project, in 2018.2.6f1, this is what I see

    upload_2018-9-9_12-45-18.png
    Double check via the Package Manager that the TMP UPM package is in fact installed.

    BTW: Unless you have modified any of the code in the package cache, it is safe to delete the whole "cache" folder. This will force all package to be updated.
     
  7. hexagonius

    hexagonius

    Joined:
    Mar 26, 2013
    Posts:
    98
    @Stephan_B ah, I see. the path is different from what you said in the other post. It works now.
     
    Stephan_B likes this.
  8. DIOBRANDO111

    DIOBRANDO111

    Joined:
    Aug 21, 2023
    Posts:
    1
    How can i do that
     
  9. a_strl

    a_strl

    Joined:
    Aug 12, 2019
    Posts:
    7
    hi, what you should do:
    create 'Unity.TextMeshPro.Editor.asmdef' and 'Unity.TextMeshPro.asmdef' in your project.
    move it manually to:
    Packages/com.unity.textmeshpro/Scripts/Editor/
    Packages/com.unity.textmeshpro/Scripts/Runtime/

    works for me right now