简体   繁体   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

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.

相关问题 Unity 中的命名空间“UnityEngine”中不存在类型或命名空间名称“Windows” - The type or namespace name `Windows' does not exist in the namespace `UnityEngine' in Unity 是什么导致“名称空间中不存在类型或名称空间名称'UI'”错误? - What is causing “The type or namespace name 'UI' does not exist in the namespace” error? 类型或名称空间名称“ Xaml”在名称空间“ Windows.UI”中不存在 - The type or namespace name 'Xaml' does not exist in the namespace 'Windows.UI' "命名空间“UnityEngine”中不存在类型或命名空间名称“UI”" - The type or namespace name 'UI' does not exist in the namespace 'UnityEngine' 无法构建我的统一项目。 “命名空间中不存在类型或命名空间名称‘Speech’”; 我能做些什么来解决? (虚拟现实统一) - Cant build my unity project. "The type or namespace name 'Speech' does not exist in the namespace"; What can I do to fix? (VR Unity) 执行清除后,名称空间中不存在类型或名称空间名称 - The type or namespace name does not exist in the namespace after executing a cleanup 如何解决“名称空间Y中不存在类型或名称空间名称X”的错误? - How do I fix error saying “The type or namespace name X does not exist in the namespace Y”? 如何修复 gRPC 和 C# 的“命名空间名称“故障”的类型在命名空间中不存在”? - How to fix "The type of namespace name "Fault" does not exist in the namespace" for gRPC and C#? 命名空间中不存在类型或命名空间名称“Exchange” - The type or namespace name 'Exchange' does not exist in the namespace 类型或名称空间名称“ Confidence”在名称空间中不存在 - The type or namespace name 'Confidence' does not exist in the namespace
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM