Unity错误CS0246(找不到命名空间)

Unity error CS0246 (namespace could not be found)

我正在尝试按照本教程进行操作:

https://www.freecodecamp.org/news/how-to-create-your-first-hololens-app-with-unity-1afa364843d4/

在我创建一个脚本来尝试旋转立方体后,我在 Unity 中遇到错误:

Assets\InteractiveCube.cs(4,7): error CS0246: The type or namespace name 'HoloToolkit' could not be found (are you missing a using directive or an assembly reference?)

这是它中断的代码行:

using HoloToolkit.Unity.InputModule;

我下载了最新版本的混合现实工具包。我正在使用 Unity 2018.4.8f1 和 Visual Studio。

如果您遇到过这个问题并且知道如何解决,请告诉我!如果您知道完成相同任务的替代方法,我也很想知道!

Holotoolkit 更新到 MRTKv2 后,命名空间发生了变化,MRTKv2 与 HoloToolkit 不兼容。现在您需要调用的 API 位于命名空间 Microsoft.MixedReality.Toolkit 中。您可以在此link中搜索符合您需求的API:https://microsoft.github.io/MixedRealityToolkit-Unity/api/Microsoft.MixedReality.Toolkit.html.

如果您坚持使用Holotoolkit,请点此link下载上一版本: https://github.com/microsoft/MixedRealityToolkit-Unity/releases/tag/2017.4.3.0-Refresh

另外,对于最新的MRTK,建议您阅读最新的微软文档:https://docs.microsoft.com/en-us/windows/mixed-reality/mrlearning-base-ch1 &https://microsoft.github.io/MixedRealityToolkit-Unity/Documentation/GettingStartedWithTheMRTK.html