[ad_1]
I’m making a VR sport for the search with Unity and for a trial I’ve a microphone with a button that it’s a must to press and say a selected phrase. For that I’m utilizing the Voice SDK however I’ve an issue, it really works within the editor however not as soon as I compile and set up the APK, I’ve the microphone permission so that’s not the difficulty.
My GameObject
that acts as a button is that this:
And the Microfono script is like this:
non-public void OnTriggerEnter(Collider different)
{
if (different.tag == "dedo" && !triggerActivated)
{
triggerActivated = true;
appVoice.Activate(GetRequestEvents());
}
}
// Set the occasions for the Voice
non-public VoiceServiceRequestEvents GetRequestEvents()
{
VoiceServiceRequestEvents occasions = new VoiceServiceRequestEvents();
occasions.OnInit.AddListener(OnInit);
occasions.OnComplete.AddListener(OnComplete);
return occasions;
}
// What occurs when the button is pressed
public void OnInit(VoiceServiceRequest request){
micro.GetComponent<Define>().enabled = false;
verde.SetActive(true);
rojo.SetActive(false);
}
// What occurs when the transcription is full
public void OnComplete(VoiceServiceRequest request){
triggerActivated = false;
verde.SetActive(false);
rojo.SetActive(true);
}
The OnTriggerEnter
technique does work, I attempted to position the verde.SetActive(true);
earlier than the appVoice
activation and it did activate a inexperienced mild when touching the microphone. Additionally the GameObject
has a baby GameObject
with the response script (perhaps it may go into the mother or father) like this:
Any concepts why this may work on the editor and never on the Quest 3? It doesn’t even launch the OnInit
occasion as a result of this line: micro.GetComponent<Define>().enabled = false;
ought to take away the define across the object and it doesn’t work.
Some information that I forgot and could also be helpful, I take advantage of Meta XR All-in-One SDK model 62 and Unity 2022.3
[ad_2]