简体   繁体   中英

How to fix "The type or namespace name 'UI' does not exist in the namespace after implementing Unit test cases in Unity using TestRunner

Hi I am trying to implement Unit test cases in Unity for my project using testrunner. I have created the test folder for edit mode. In the test folder there is the assembly definition file.In the assembly definition file you have to give reference to where the scripts are created.

In the scripts folder I have created the assembly definition file by right-clicking in the scripts folder->Create->Assembly definition.But the moment I create this file,problems start arising like:

Assets\Scripts\ExplodeViewLabels.cs(4,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\LandingGear.cs(5,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\SceneController.cs(3,17): error CS0234: The type or namespace name 'MixedReality' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

and much more the screenshot I am attaching here

I tried overcoming the error by giving reference to the assembly definition file in the scripts as Unity.TextMeshPro and then click apply. The error for textMeshPro was done but other errors still persists like

Assets\Scripts\SceneController.cs(3,17): error CS0234: The type or namespace name 'MixedReality' does not exist in the namespace 'Microsoft' (are you missing an assembly reference?)

and much more. I tried to give whatever reference I had with Microsoft.MixedReality, like the ones I have indicated in this screenshot . I addded all the three which I have indicated in the red box in the screenshot but there is no use.

Go to your SceneController.cs script and see which using statements you have. I think probably you're missing assembly definitions to the actual package(s) you're using in the script. Assembly definitions are kind of a pain to use and it's not enough to have SOME of the files included.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM