protected override void Start() { if (PersistentKeywords) { DontDestroyOnLoad(gameObject); } speechKeywordRecognizedEventData = new SpeechKeywordRecognizedEventData(EventSystem.current); int keywordCount = Keywords.Length; if (keywordCount > 0) { var keywords = new string[keywordCount]; for (int index = 0; index < keywordCount; index++) { keywords[index] = Keywords[index].Keyword; } keywordRecognizer = new KeywordRecognizer(keywords, recognitionConfidenceLevel); keywordRecognizer.OnPhraseRecognized += KeywordRecognizer_OnPhraseRecognized; base.Start(); } else { Debug.LogError("Must have at least one keyword specified in the Inspector on " + gameObject.name + "."); } }
protected override void Start() { base.Start(); speechKeywordRecognizedEventData = new SpeechKeywordRecognizedEventData(EventSystem.current); int keywordCount = Keywords.Length; if (keywordCount > 0) { string[] keywords = new string[keywordCount]; for (int index = 0; index < keywordCount; index++) { keywords[index] = Keywords[index].Keyword; } keywordRecognizer = new KeywordRecognizer(keywords); keywordRecognizer.OnPhraseRecognized += KeywordRecognizer_OnPhraseRecognized; if (RecognizerStart == RecognizerStartBehavior.AutoStart) { keywordRecognizer.Start(); } } else { Debug.LogError("Must have at least one keyword specified in the Inspector on " + gameObject.name + "."); } }
private void InitializeEventDatas() { inputEventData = new InputEventData(EventSystem.current); sourceStateEventData = new SourceStateEventData(EventSystem.current); manipulationEventData = new ManipulationEventData(EventSystem.current); navigationEventData = new NavigationEventData(EventSystem.current); holdEventData = new HoldEventData(EventSystem.current); speechKeywordRecognizedEventData = new SpeechKeywordRecognizedEventData(EventSystem.current); }
void ISpeechHandler.OnSpeechKeywordRecognized(SpeechKeywordRecognizedEventData eventData) { UnityEvent keywordResponse; // Check to make sure the recognized keyword exists in the methods dictionary, then invoke the corresponding method. if (enabled && responses.TryGetValue(eventData.RecognizedText.ToLower(), out keywordResponse)) { keywordResponse.Invoke(); } }
private void InitializeEventDatas() { inputEventData = new InputEventData(EventSystem.current); sourceClickedEventData = new InputClickedEventData(EventSystem.current); sourceStateEventData = new SourceStateEventData(EventSystem.current); manipulationEventData = new ManipulationEventData(EventSystem.current); navigationEventData = new NavigationEventData(EventSystem.current); holdEventData = new HoldEventData(EventSystem.current); #if UNITY_WSA || UNITY_STANDALONE_WIN speechKeywordRecognizedEventData = new SpeechKeywordRecognizedEventData(EventSystem.current); dictationEventData = new DictationEventData(EventSystem.current); #endif }
private void InitializeEventDatas() { inputEventData = new InputEventData(EventSystem.current); sourceClickedEventData = new InputClickedEventData(EventSystem.current); sourceStateEventData = new SourceStateEventData(EventSystem.current); sourceRotationEventData = new SourceRotationEventData(EventSystem.current); sourcePositionEventData = new SourcePositionEventData(EventSystem.current); manipulationEventData = new ManipulationEventData(EventSystem.current); navigationEventData = new NavigationEventData(EventSystem.current); holdEventData = new HoldEventData(EventSystem.current); pointerSpecificEventData = new PointerSpecificEventData(EventSystem.current); inputPositionEventData = new InputPositionEventData(EventSystem.current); selectPressedEventData = new SelectPressedEventData(EventSystem.current); gamePadEventData = new GamePadEventData(EventSystem.current); xboxControllerEventData = new XboxControllerEventData(EventSystem.current); #if UNITY_WSA || UNITY_STANDALONE_WIN speechKeywordRecognizedEventData = new SpeechKeywordRecognizedEventData(EventSystem.current); dictationEventData = new DictationEventData(EventSystem.current); #endif }