03-21-2024 03:38 AM - edited 03-21-2024 03:39 AM
Hi,
I am making a game for the quest with Unity and for a trial I have a microphone with a button that you have to press and say a specific phrase. For that I am using the Voice SDK but I have a problem, it works in the editor but not once I compile and install the apk, I have the microphone permission so that is not the issue.
My GameObject that acts as a button is this:
And the Microfono script is like this:
private void OnTriggerEnter(Collider other)
{
if (other.tag == "dedo" && !triggerActivated)
{
triggerActivated = true;
appVoice.Activate(GetRequestEvents());
}
}
// Set the events for the Voice
private VoiceServiceRequestEvents GetRequestEvents()
{
VoiceServiceRequestEvents events = new VoiceServiceRequestEvents();
events.OnInit.AddListener(OnInit);
events.OnComplete.AddListener(OnComplete);
return events;
}
// What happens when the button is pressed
public void OnInit(VoiceServiceRequest request){
micro.GetComponent<Outline>().enabled = false;
verde.SetActive(true);
rojo.SetActive(false);
}
// What happens when the transcription is complete
public void OnComplete(VoiceServiceRequest request){
triggerActivated = false;
verde.SetActive(false);
rojo.SetActive(true);
}
The OnTriggerEnter method does work, I tried to place the verde.SetActive(true); before the appVoice activation and it did activate a green light when touching the microphone. Also the GameObject has a child GameObject with the response script (maybe it could go into the parent) like this:
Any ideas why this might work on the editor and not on the quest 3? It does not even launch the OnInit event because this line: micro.GetComponent<Outline>().enabled = false; should remove the outline around the object and it does not work.
Some info that I forgot and may be usefull, I use Meta XR All-in-One SDK version 62 and Unity 2022.3