【问题标题】:error CS0234: The type or namespace name 'Persistence' does not exist in the namespace 'UnityEngine.XR.WSA' (are you missing an assembly reference?)错误 CS0234:命名空间“UnityEngine.XR.WSA”中不存在类型或命名空间名称“Persistence”(您是否缺少程序集引用?)
【发布时间】:2019-09-03 21:06:28
【问题描述】:

我目前正在为安卓开发一个应用程序。在我的代码中,我使用命名空间UnityEngine.XR.WSA.Persistence。当我在编辑器上启动应用程序时,我没有错误,但是当我尝试构建它以将其发送到我的手机时,我得到以下一个:

类型或命名空间名称“Persistence”不存在于 命名空间“UnityEngine.XR.WSA”。你错过了一个程序集 参考?”

因为它在编辑器上工作,这不是很奇怪吗?我该如何解决?

【问题讨论】:

    标签: visual-studio unity3d


    【解决方案1】:

    WSA 代表 Windows Store Apps。这仅在为Universal Windows Platform 构建应用程序时可用。尤其是UnityEngine.XR.WSA.Persistence afaik 是或至少是以前由Microsoft 开发的,甚至仅用于HoloLens

    它在编辑器中不会抛出异常,但 afaik 一些#if preprocessors 确保它在那里也什么都不做。


    在为Android 平台构建应用时不可用。

    要删除脚本中的错误,您可以使用 #if preprocessorsPlatform dependent compilation 之类的

    #if UNITY_WSA
        // anything using the UnityEngine.XR.WSA namespace
    #else
        // alternative implementation for different platform
    #endif
    

    然而,这个功能当然在 Android 上不可用,所以如果你需要类似的东西,你必须使用另一个库或想出一个;)

    【讨论】:

      猜你喜欢
      • 2021-06-14
      • 2017-05-01
      • 2020-12-17
      • 1970-01-01
      • 1970-01-01
      • 2020-03-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多