Can't use packages with unit tests

I’m trying to do unit testing on a project that uses TextMeshPro and I’m running into this error: “error CS0246: The type or namespace name ‘TMPro’ could not be found (are you missing a using directive or an assembly reference?)”. Here are the steps to recreate:

  • Create a Project
  • Install TextMeshPro from the package manager
  • Create a script that uses TextMeshPro
  • Create an assembly reference in the same directory as the script
  • Use the Test Runner to create an Edit Mode test folder
  • Create a test
  • Create a reference in the Edit Mode Assembly Reference to the script assembly reference
  • Create a reference in the Edit Mode Assembly Reference to Unity.TextMeshPro

This issue is similar to the below link, but I wasn’t able to solve my issues with the solutions there.

1 Like

Having this issue also with Visual Studio when using ‘using TMPro’ in scripts.

You might want to re-ask the question a little deeper in this forum here:

May I ask why do you make references? Why don’t you just put the reference in the assembly file?
5936105--635219--answer.PNG

1 Like