/// <summary> /// IntentRecognizer & event handlers cleanup after use /// </summary> private async void StopIntentRecognition() { if (recognizer != null) { await recognizer.StopContinuousRecognitionAsync().ConfigureAwait(false); recognizer.Recognizing -= Recognizer_Recognizing; recognizer.Recognized -= Recognizer_Recognized; recognizer.Canceled -= Recognizer_Canceled; recognizer.Dispose(); recognizer = null; } }
/// <summary> /// IntentRecognizer & event handlers cleanup after use /// </summary> public async void StopIntentRecognition() { if (intentreco != null) { await intentreco.StopContinuousRecognitionAsync().ConfigureAwait(false); intentreco.Recognizing -= RecognizingHandler; intentreco.Recognized -= RecognizedHandler; intentreco.SpeechStartDetected -= SpeechStartDetectedHandler; intentreco.SpeechEndDetected -= SpeechEndDetectedHandler; intentreco.Canceled -= CanceledHandler; intentreco.SessionStarted -= SessionStartedHandler; intentreco.SessionStopped -= SessionStoppedHandler; intentreco.Dispose(); intentreco = null; recognizedString = "Intent Recognizer is now stopped."; UnityEngine.Debug.LogFormat("Intent Recognizer is now stopped."); } }