void Start() { if (SpeechRecognizer.ExistsOnDevice()) { SpeechRecognizerListener listener = GameObject.FindObjectOfType <SpeechRecognizerListener>(); listener.onAuthorizationStatusFetched.AddListener(OnAuthorizationStatusFetched); listener.onAvailabilityChanged.AddListener(OnAvailabilityChange); listener.onErrorDuringRecording.AddListener(OnError); listener.onErrorOnStartRecording.AddListener(OnError); listener.onFinalResults.AddListener(OnFinalResult); listener.onPartialResults.AddListener(OnPartialResult); listener.onEndOfSpeech.AddListener(OnEndOfSpeech); listener.onSupportedLanguagesFetched.AddListener(OnSupportedLanguagesFetched); startRecordingButton.enabled = false; SpeechRecognizer.GetSupportedLanguages(); SpeechRecognizer.RequestAccess(); } else { resultText.text = "Sorry, but this device doesn't support speech recognition"; startRecordingButton.enabled = false; } }