Hi,
Im working on an Iphone game that replay player voice when player hold a button on screen. The button swap sprite when player hold down or release. It work fine until the button down handle Microphone.Start() and Button up handle Microphone.End(); The Sprite swap seem to delay an amount of time even when i put both of those function into coroutine. Any Idea how to handle this sprite swap delay?
here is a bit of my code.
public void OnPointerDown(PointerEventData eventData){
StartCoroutine(MouseDown());
}
public void OnPointerUp(PointerEventData eventData){
StartCoroutine(MouseUp());
}
IEnumerator MouseDown()
{
if(Microphone.devices.Length > 0 && !Microphone.IsRecording(null))
{
goAudioSource.clip = Microphone.Start(null, true, 10, 8000);
}
else
{
Debug.Log("Microphone not connected");
}
yield return null;
}
IEnumerator MouseUp()
{
Microphone.End(null);
yield return null;
}