Search Unity

Text Mesh Pro type or namespace issue

Discussion in 'Editor & General Support' started by Snackmix, Jan 15, 2020.

  1. Snackmix

    Snackmix

    Joined:
    Apr 3, 2013
    Posts:
    36
    I've been doing a lot of googling which says that you need to remove TextMeshPro and reimport it from the Package Manager. I've gone ahead and done this multiple times with no success.

    I'm currently using TextMeshPro version 2.0.1, and on Unity version 2019.2.17f1.

    I get the following errors in my console on Unity:
    Assets\Scripts\UI\SelectedUnitDisplay.cs(1,7): error CS0246: The type or namespace name 'TMPro' could not be found (are you missing a using directive or an assembly reference?)
    Assets\Scripts\UI\SelectedUnitDisplay.cs(6,12): error CS0246: The type or namespace name 'TextMeshProUGUI' could not be found (are you missing a using directive or an assembly reference?)

    If I open up Visual Studio I see the same error inside of there, however if I hit alt + enter and click "Add reference to Unity.TextMeshPro.dll" the errors inside of Visual Studio will go away. They will not go away from the console in Unity, and Unity will not allow me to play my scene as it says I need to fix the compile errors.

    Any ideas? I'm still digging through things online but there doesn't seem to be a whole lot of information. Thanks!
    Snackmix
     
  2. Snackmix

    Snackmix

    Joined:
    Apr 3, 2013
    Posts:
    36
    Nevermind I found the issue! I had created an AssmeblyDefinition for my scripts so that I could write unit tests. I needed to go add the reference to Unity.TextMeshPro, and Unity.TextMeshPro.Editor to my Assembly Definition References. This seems to have fixed my issues!
     
    Alan47, KWaldt and lukasz13 like this.
  3. VinylPixels

    VinylPixels

    Joined:
    Dec 10, 2016
    Posts:
    13
    Hi, thanks for providing that anwer! I've had the same issue and since I'm new to testing I would probably waste a lot of time trying to find that solution :)
     
    Snackmix likes this.
  4. tapiovalli

    tapiovalli

    Joined:
    Jul 26, 2018
    Posts:
    11
    I have the same problem, the same fix worked. The thing that bugs me though, is that why this is so? All other libs work just fine and just the TMP breaks like this. Very confusing and frustrating.