简体   繁体   中英

The type or namespace name `Windows' does not exist in the namespace `UnityEngine' in Unity

My project works very well but when I made the APK file, the error appears.

The type or namespace name Windows' does not exist in the namespace UnityEngine'. Are you missing an assembly reference?

The type or namespace name `ConfidenceLevel' could not be found. Are you missing an assembly reference?

The type or namespace name `PhraseRecognizer' could not be found. Are you missing an assembly reference?

The type or namespace name `PhraseRecognizedEventArgs' could not be found. Are you missing an assembly reference?

using UnityEngine.Windows.Speech; <-- These places show when I click top error.

I have found the solution as :

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

  2. Assets --> ReimportAll.

  3. I have added #if UNITY_EDITOR, the error is gone but it does not work on android: https://docs.unity3d.com/Manual/PlatformDependentCompilation.html

But It's not working.

Can some body help me? Thanks all!

The Windows namespace in Unity is made for Windows PC build only. It will not and should not work on Android. It should not even build for Android to begin with and you should not try to make Unity use it on Android.

Use UNITY_STANDALONE_WIN instead of UNITY_EDITOR to prevent it from compiling for any other platform. If you are looking to do Speech Recognition in Unity, see this post where I described classes required to make our own plugin or use the already made asset I linked in that answer.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM