Search Unity

Can't use packages with unit tests

Discussion in 'Scripting' started by fpdotmonkey, Jun 2, 2020.

  1. fpdotmonkey

    fpdotmonkey

    Joined:
    Jun 27, 2017
    Posts:
    3
    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.
    https://forum.unity.com/threads/namespace-tmpro-not-found-in-test-runner-test.541387/
     
    ROBYER1 likes this.
  2. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    1,454
    Having this issue also with Visual Studio when using 'using TMPro' in scripts.
     
  3. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    38,738
  4. May I ask why do you make references? Why don't you just put the reference in the assembly file?
    answer.PNG
     
    ManjitSBedi likes this.