Can't use namespace 'TMPro' with the TextMeshPro Package (2018.2.0f2)

Hello, I’m having a problem with the Text Mesh Pro package.

Whenever I try to use the namespace ‘TMPro’ in Unity 2018.2.0f2, it says that the namespace doesn’t exist. And when I try to open the TextMeshProUGUI.cs in the solution explorer, it says that the file doesn’t exist neither.

However if it did compile in a previous version (2018.1.0f2) and it works fine, but I can’t modify the script in my current version. Could this be a bug?

Namespace Error:

Solution Explorer:

Check if you are using Assembly Definition file for your scripts. If so, then open your .asmdef file with the inspector and make sure that Unity.TextMeshPro is on the Assembly Definition References list. It is not added automatically when you import TextMeshPro assets.

Just Download the Text mesh Pro From the Assert Store, To solve this Problem (“TMpro”)

if U already have that then Delete entire folder of Text mesh Pro and Try it to Reimport the TMPro

Ok here’s a temporary solution (Maybe it’s not the best solution):

  1. In the editor, in the folder explorer go to Packages>TextMesh Pro, right-click the TMP folder and select show explorer, copy the folder direction or just go to C:\Users\ Your User \AppData\Local\Unity\cache\packages\ You’ll find all the unity packages, in this case com.unity.textmeshpro@1.2.4.

  2. And follow one of these steps (I’m not sure which one is the best):

a. Copy the scripts you need, in my case, TextMeshProUGUI.cs and paste them in Your Project Folder \Packages in the corresponding subfolder of the script, and now the visual studio solution should be able to find that .cs file.

b. In visual studio in the solution explorer (Usually in the right part of the screen) find the folder Unity.TextMeshPro>Packages>com.unity.textmeshpro>Scripts>Runtime and right-click and add an existing item, and add the script you need.

Apparently, that happens because in this Unity version, the Package Manager tries to copy and Paste the packages to a local project folder, but for some reason, they are empty and visual studio expects to be there all the package files in there.
I still don’t know if that’s a problem in this unity version or something is wrong in my PC.

Better solution: Just update Visual Studio with the Visual Studio Installer

Here is the answer to all your problems with TextMesh Pro and unity 2018.2:

I had to realize, but here is explained.

  • TextMesh Pro was added to unity as of 2018.2

  • I was working on an old project when I saw this conflict so I had to remove tmp from our assets and upgrade the scripting library to .net 4.0 (from 3.5)

  • I had also upgrade visual studio two have the unity development package via Visual Studio Installer > modify

You should take this folder C:\Users\USERNAME\AppData\Local\Unity\cache\packages\\com.unity.textmeshpro@2.0.1 and copy it to your project folder TextMeshPro
It worked for me.

Since I run into this issue over and over myself, and then I forget how it gets solved, here’s the usual issue and a solution without any hacks or copying.

The problem most likely is that Unity Visual Studio Code (or Visual Studio) integration is not generating all the necessary csproj files. Namely those that come from Unity package manager (usually TextMeshPro is one of them).

The solution almost always is to either downgrade Visual Studio Code (if you use VS Code) integration plugin, especially if you just upgraded it, or to see if there is a newer version with a fix. Sometimes newer versions are not “verified” so they are not suggested as an upgrade directly in Unity Package Manager.

Don’t copy anything from anywhere, always find and fix the root cause instead.