- Home /
DictationRecognizer always fails with UnknownError
I am using Windows 10 and trying to use the DictationRecognizer.
It always results in an UnknownError. I'm at a loss for what to try to fix it.
Cortana works on my machine and understands dictation. I tried building with a Windows Store build but that didn't affect the result. The KeywordRecognizer works.
Dictation completed unsuccessfully: UnknownError.
UnityEngine.Debug:LogErrorFormat(String, Object[])
DictationTest:<Start>m__5(DictationCompletionCause) (at Assets/DictationTest.cs:35)
Here's the code I'm using. It's adapted from these docs.
using UnityEngine;
using System.Collections;
using UnityEngine.Windows.Speech;
public class DictationTest : MonoBehaviour
{
private DictationRecognizer m_DictationRecognizer;
void Start()
{
Debug.Log ("phrase rec sup" + PhraseRecognitionSystem.isSupported);
m_DictationRecognizer = new DictationRecognizer(DictationTopicConstraint.Form);
m_DictationRecognizer.DictationResult += (text, confidence) =>
{
Debug.LogFormat("Dictation result: {0}", text);
};
m_DictationRecognizer.DictationHypothesis += (text) =>
{
Debug.LogFormat("Dictation hypothesis: {0}", text);
};
m_DictationRecognizer.DictationComplete += (completionCause) =>
{
if (completionCause != DictationCompletionCause.Complete)
Debug.LogErrorFormat("Dictation completed unsuccessfully: {0}.", completionCause);
};
m_DictationRecognizer.DictationError += (error, hresult) =>
{
Debug.LogErrorFormat("Dictation error: {0}; HResult = {1}.", error, hresult);
};
m_DictationRecognizer.Start();
}
}
Answer by shiningsword · May 31, 2017 at 08:43 AM
I just updated to the latest windows 10, this problem is solved. You can manually update your windows here https://www.microsoft.com/en-us/software-download/windows10
Answer by pmsv · Nov 11, 2016 at 08:34 AM
If you press "Play" in Unity you will see the "UnknownError". But if you "Build and Run" It will work.
Thanks for the tip re: Build & Run. I tried your suggestion and it initially didn't work, then I changed my build settings for Windows from x86_64 to x86, and then B&R worked! Getting same error in play mode, as you say. I wonder if there's some way to get the player to not use 64-bit components somehow? I think I will try the 32-bit version of Unity to test my theory. In any case, cheers and thanks again!
UPDATE: tried Unity 32-bit and play mode works fine. So at least now we know it's some sort of 64-bit thing.
Answer by connorericson · Nov 21, 2016 at 07:20 AM
I am having the same issue. Anybody know why it won't work on 64-bit Unity? Or if there's a way to fix it other than using 32-bit?
Answer by clavius65 · Oct 16, 2016 at 07:20 AM
I have the exact same problem, only solution that has been found thus far is to roll back pre-Win10-Anniversary update. Not sure who broke what but some attention from either Microsoft or Unity would be much appreciated!
Answer by CommanderThrawn · Nov 18, 2016 at 07:43 AM
EDIT: I've been in contact with Unity, and they claim it's the fault of Windows and they will never fix it. The solution is to downgrade windows (or upgrade to the next version when it comes out), as 1607 is broken. The problem is, any users on the Anniversary Edition won't be able to use your stuff.
Our solution, for those who really need this, is to spin the voice recognition off into a separate process, and send the inputs back into Unity.
Good luck!
" Spin the voice recognition off into a separate process, and send the inputs back into Unity": does this mean that we create a separate process in 1607 version to do the voice recognition?
Basically you need to create a separate process in the background which uses different voice detection software, and have it communicate back to Unity. The problem with this is, the voice detection software we tried really sucked. Basically it was pre-Cortana Windows voice detection, and it was TERRIBL$$anonymous$$
Eventually, we just decided to tell people that, if they wanted voice recognition, they needed an up-to-date version of Windows. If you want, you can try using Google's voice recognition APIs, which should work fine on all versions of Windows, though you'll need to pay for those...