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); SpeechRecognizer.RequestAccess(); } else { resultText.text = "Sorry, but this device doesn't support speech recognition"; } spawnAndGuide = GameObject.Find("ARSessionOrigin").GetComponent <SpawnAndGuide>(); assistantSpeak = GetComponent <AssistantSpeak>(); resultText = GameObject.Find("VoiceText").GetComponent <Text>(); }
private void Awake() { assistant = GameObject.FindGameObjectWithTag("assistant"); assistantSpeak = assistant.GetComponent <AssistantSpeak>(); }