Skip to content

Instantly share code, notes, and snippets.

@martindevans
Created September 26, 2022 13:45
Show Gist options
  • Save martindevans/ffd22e45c5faeae320f780ba7d2ba206 to your computer and use it in GitHub Desktop.
Save martindevans/ffd22e45c5faeae320f780ba7d2ba206 to your computer and use it in GitHub Desktop.
public class DissonanceMicPermission
: MonoBehaviour
{
void OnEnable()
{
StartCoroutine(RequestPermission());
}
IEnumerator CheckPermission()
{
yield return Application.RequestUserAuthorization(UserAuthorization.Microphone);
if (Application.HasUserAuthorization(UserAuthorization.Microphone))
{
Debug.Log("Microphone Permission Granted.");
FindObjectOfType<DissonanceComms>().ResetMicrophoneCapture();
}
else
{
Debug.Log("Microphone Permission Denied!");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment