繁体   English   中英

如何修复“使用 TestRunner 在 Unity 中实施单元测试用例后命名空间中不存在类型或命名空间名称‘UI’

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

您好,我正在尝试使用 testrunner 为我的项目在 Unity 中实施单元测试用例。 我已经为编辑模式创建了测试文件夹。 在测试文件夹中有程序集定义文件。在程序集定义文件中,您必须引用创建脚本的位置。

在脚本文件夹中,我通过右键单击脚本文件夹->创建->程序集定义创建了程序集定义文件。但是在我创建这个文件的那一刻,问题开始出现,如:

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?)

还有更多我在这里附上的截图

我尝试通过将脚本中的程序集定义文件引用为 Unity.TextMeshPro来克服错误,然后单击“应用”。 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?)

以及更多。 我试图提供我对 Microsoft.MixedReality 的任何参考,就像我在这个屏幕截图中指出的那样。 我添加了我在屏幕截图中红色框中指示的所有三个,但没有用。

Go 到您的 SceneController.cs 脚本并查看您有哪些 using 语句。 我认为您可能缺少您在脚本中使用的实际包的程序集定义。 程序集定义使用起来有点麻烦,仅包含一些文件是不够的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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