Quantcast
Channel: Questions in topic: "error"
Viewing all articles
Browse latest Browse all 7934

SpeechRecognitionEngine.InstalledRecognizers() returns null within Unity.

$
0
0
Hello, I am trying to use the speech recognition system from the .NET 3.0 framework within Unity. I therefore have imported the System.Speech.dll, from .NET 3.0 since higher version did not work, into the assets folder together with its dependencies. I know that what I am trying to do might not work because Unity uses .NET 2.0, but I still want to give it a try. It all seems to work and I can run the game fine, but when I run it I get the error: NullReferenceException: Object reference not set to an instance of an object System.Speech.Internal.ObjectTokens.RegistryDataKey.HKEYfromRegKey (Microsoft.Win32.RegistryKey regKey) System.Speech.Internal.ObjectTokens.RegistryDataKey.RootHKEYFromRegPath (System.String rootPath) System.Speech.Internal.ObjectTokens.RegistryDataKey.Open (System.String registryPath, Boolean fCreateIfNotExist) System.Speech.Internal.ObjectTokens.ObjectTokenCategory.Create (System.String sCategoryId) System.Speech.Recognition.SpeechRecognitionEngine.InstalledRecognizers () VoiceCommandListener.Start () (at Assets/Scripts/VoiceCommandListener.cs:14) The line of code is: SpeechRecognitionEngine speechRecognitionEngine = new SpeechRecognitionEngine(SpeechRecognitionEngine.InstalledRecognizers()[0]); When I run the same line of code outside of Unity it works fine and just grabs the default and first recognizer, but somehow it doesn't work within Unity. I have tried switching between using .NET 2.0 instead of .NET 2.0 subset, or running the following code block instead: SpeechRecognitionEngine speechRecognitionEngine = null; foreach (RecognizerInfo info in SpeechRecognitionEngine.InstalledRecognizers()) { if (info.Culture.Equals(requiredCulture) && info.Id == requiredId ) { speechRecognitionEngine = new SpeechRecognitionEngine(info); break; } } This gives the same result and this time again at the line of code which uses "SpeechRecognitionEngine.InstalledRecognizers()". Does anybody know why it does not return anything? Thanks in advance. Ron

Viewing all articles
Browse latest Browse all 7934

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>