- Home /
KeywordRecognizer does not seem to work
Hi everyone,
This is my very first question on this site so I apologize if I'm at the wrong place.
I am working on gaze-based interactions in VR with Unity (v2018.3.14f1) and I want to use KeywordRecognizer
class to suit my needs. I used the script from the doc KeywordRecognizer. However nothing happens once I play. Here is my script :
using UnityEngine;
using UnityEngine.Windows.Speech;
using System.Text;
using System;
public class VoiceManager : MonoBehaviour
{
private string[] m_Keywords;
private KeywordRecognizer m_Recognizer;
void Start()
{
m_Keywords = new string[] { "take", "drop" };
m_Recognizer = new KeywordRecognizer(m_Keywords, ConfidenceLevel.Low);
m_Recognizer.OnPhraseRecognized += OnPhraseRecognized;
m_Recognizer.Start();
}
private void OnPhraseRecognized(PhraseRecognizedEventArgs args)
{
print("OnPhraseRecognized called");
StringBuilder builder = new StringBuilder();
builder.AppendFormat("{0} ({1}){2}", args.text, args.confidence, Environment.NewLine);
builder.AppendFormat("\tTimestamp: {0}{1}", args.phraseStartTime, Environment.NewLine);
builder.AppendFormat("\tDuration: {0} seconds{1}", args.phraseDuration.TotalSeconds, Environment.NewLine);
Debug.Log(builder.ToString());
}
}
What bothers me is that the last time I tried it DID work. I changed nothing since. The line with print("OnPhraseRecognized called");
is only here to see if the function is called. But once in game, no matter what I say, nothing happens.
I am using VIVE Pro Eye for voice input.
Regards
Your answer
Follow this Question
Related Questions
Help In Making a SphereCast for 3D Tire! Working RayCast Script included! 0 Answers
How do I use controller knob input like mouse position? (New Input System) 1 Answer
C# Touch Script - Fix GameObject touch. 0 Answers
Dynamic rebinding not working in new input system. 1 Answer
Smooth movement help? 1 Answer