AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
DisplaySpeechKeywords.cs
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License. See LICENSE in the project root for license information.
3 
4 using UnityEngine;
5 
6 namespace HoloToolkit.Unity.InputModule.Tests
7 {
8  public class DisplaySpeechKeywords : MonoBehaviour
9  {
11  public TextMesh TextMesh;
12 
13  private void Start()
14  {
15  if (SpeechInputSource == null || TextMesh == null)
16  {
17  Debug.Log("Please check the variables in the Inspector on DisplaySpeechKeywords.cs on" + name + ".");
18  return;
19  }
20 
21  TextMesh.text = "Try saying:\n";
22  for (var i = 0; i < SpeechInputSource.Keywords.Length; i++)
23  {
24  TextMesh.text += " " + SpeechInputSource.Keywords[i].Keyword + "\n";
25  }
26  }
27  }
28 }
SpeechInputSource allows you to specify keywords and methods in the Unity Inspector, instead of registering them explicitly in code. This also includes a setting to either automatically start the keyword recognizer or allow your code to start it.