Search Unity

Question How do I fill out the "Microphone Usage Description" for a Standalone macOS build?

Discussion in 'macOS' started by Secret_Juice123, Apr 26, 2021.

  1. Secret_Juice123

    Secret_Juice123

    Joined:
    Feb 24, 2013
    Posts:
    4
    I've just finished up my jam game for Ludum Dare 48, and I've got some requests to port it over to macOS.

    Problem is that I'm using Unity's Microphone API for a core mechanic of the game, and when I try to export for a Standalone macOS build, I get these errors:

    -Microphone class is used but Microphone Usage Description is empty. App will not work on macOS 10.14+.
    -Exception: A required capability description is not set.


    The build results in a failure each time.

    Googling these issues led me to believe that I apparently just need to fill in some text wherever the "Microphone Usage Description" is. Though, it seems that the forum posts I see describe the process for iOS, but not for macOS. I can't find in the Player Settings where to change it.

    Am I missing something? My personal machine is Windows 10, so I have no experience working with mac. Unity version is 2020.2.4f

    Let me know if there's any more information I could provide.

    Thanks!
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    It's in player settings: upload_2021-4-26_17-55-20.png
     
  3. Secret_Juice123

    Secret_Juice123

    Joined:
    Feb 24, 2013
    Posts:
    4
    Thanks for the reply, but that field is simply absent in my Player Settings...

    upload_2021-4-26_20-33-26.png

    When I switch it from Mono to IL2CPP it remains the same.

    upload_2021-4-26_20-34-34.png

    These are my build settings.
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    :eek::eek::eek:

    Looks like there's a bug that makes this UI label appear only on macOS editor. Furthermore, looks like the scripting API to set it isn't public! Could you submit a bug report for it?

    In the meantime, you can workaround it using this editor script:

    Code (csharp):
    1. typeof(PlayerSettings.macOS).GetProperty("microphoneUsageDescription", BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static).SetValue(null, "YOUR DESCRIPTION GOES HERE");
     
    JoeStrout likes this.
  5. Secret_Juice123

    Secret_Juice123

    Joined:
    Feb 24, 2013
    Posts:
    4
    Nice! That's definitely worth a shot.

    Sorry for my ignorance though, how would I implement that block of code in my project? I've done next to zero with editor scripting.
     
  6. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
  7. LuGus-Jan

    LuGus-Jan

    Joined:
    Oct 3, 2016
    Posts:
    179
    Is there any progress on when this will land in any Unity 2020 release? Currently using 2020.3.16 and this field is still not showing.
     
  8. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    Yes, the fixes landed to 2021.1.18f1 and 2020.3.17f1. 2019.4 backport is still in progress.
     
    LuGus-Jan likes this.
  9. LuGus-Jan

    LuGus-Jan

    Joined:
    Oct 3, 2016
    Posts:
    179
    @Tautvydas-Zilys Thanks for the quick response! Looking forward to the next version then. :)