[英]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.您好,我正在尝试使用 testrunner 为我的项目在 Unity 中实施单元测试用例。 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.我尝试通过将脚本中的程序集定义文件引用为 Unity.TextMeshPro来克服错误,然后单击“应用”。 The error for textMeshPro was done but other errors still persists like
textMeshPro 的错误已完成,但其他错误仍然存在,例如
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 .
我试图提供我对 Microsoft.MixedReality 的任何参考,就像我在这个屏幕截图中指出的那样。 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. Go 到您的 SceneController.cs 脚本并查看您有哪些 using 语句。 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.
程序集定义使用起来有点麻烦,仅包含一些文件是不够的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.