【问题标题】:The type or namespace name `Windows' does not exist in the namespace `UnityEngine' in UnityUnity 中的命名空间“UnityEngine”中不存在类型或命名空间名称“Windows”
【发布时间】:2017-10-02 05:48:57
【问题描述】:

我的项目运行良好,但是当我制作 APK 文件时,出现了错误。

类型或命名空间名称Windows' does not exist in the namespaceUnityEngine'。您是否缺少程序集参考?

找不到类型或命名空间名称“ConfidenceLevel”。您是否缺少程序集参考?

找不到类型或命名空间名称“PhraseRecognizer”。您是否缺少程序集参考?

找不到类型或命名空间名称“PhraseRecognizedEventArgs”。您是否缺少程序集参考?

使用 UnityEngine.Windows.Speech;

我找到了解决方案:

  1. http://answers.unity3d.com/questions/42719/how-should-i-add-references-to-additional-mono-ass.html.

  2. 资产 --> ReimportAll。

  3. 我添加了#if UNITY_EDITOR,错误消失了,但在android上不起作用:https://docs.unity3d.com/Manual/PlatformDependentCompilation.html

但它不起作用。

可以帮助我吗?谢谢大家!

【问题讨论】:

    标签: c# android unity3d namespaces mono


    【解决方案1】:

    Unity 中的 Windows 命名空间仅适用于 Windows PC 版本。它不会也不应该在 Android 上运行。它甚至不应该一开始就为 Android 构建,你也不应该尝试让 Unity 在 Android 上使用它。

    使用UNITY_STANDALONE_WIN 而不是UNITY_EDITOR 以防止它为任何其他平台编译。如果您希望在 Unity 中进行语音识别,请参阅 this 帖子,其中我描述了制作我们自己的插件或使用我在该答案中链接的已制作资产所需的类。

    【讨论】:

    • 感谢您的回答!我会研究更多... :)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-06-19
    • 1970-01-01
    • 2012-05-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多