Search code examples
c#windowsunity-game-enginemicrophone

Unity doesn't recognize microphone, but Windows does


So I got a little problem, I'm trying to get a recording using my microphone in Unity. The mic is plugged-in and is recognized by Windows. Recordings with Audacity are working too. In Unity however the microphone is not recognized.

    foreach (string device in Microphone.devices)
    {
        print("Name: " + device);
    }

This code gives nothing back, and this isn't giving me any errors either:

    yield return Application.RequestUserAuthorization(UserAuthorization.Microphone);
    if (!Application.HasUserAuthorization(UserAuthorization.Microphone))
    {
        throw new NotSupportedException("Microphone using not authorized");
    }

This as a result gives me an IndexOutOfRangeException:

Microphone.Start(Microphone.devices[0], false, 10, 16000);

Did I forget anything? I tried it with 2 different microphones, but both are not recognized within Unity, even though Windows can see them.


Solution

  • Well I found the issue. Probably driver related. I removed the Realtek HD Audio software from my pc, and everything worked.