public void RecordStop() { if (recording) { // Turn off the microphone. microphoneManager.StopRecording(); // Restart the PhraseRecognitionSystem and KeywordRecognizer microphoneManager.StartCoroutine("RestartSpeechSystem", GetComponent <KeywordManager>()); if (DictationTypeLUIS == DictationToLUISType.OnPause) { SendToLuis(); microphoneManager.ClearDictation(); } // Set proper UI state and play a sound. SetUI(false, Message.SendMessage, stopAudio); PlayButtonObject.SetActive(true); RecordStopButtonObject.SetActive(false); RecordButtonObject.SetActive(true); recording = false; } }