簡體   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