Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Trouble Opening Finder Window and Accessing Hardware on MacOS

Discussion in 'macOS' started by OscarCybernetic, Jul 31, 2019.

  1. OscarCybernetic

    OscarCybernetic

    Joined:
    Sep 12, 2018
    Posts:
    23
    I have a fairly large project in Unity 2018.4.2 that is failing in two places: connecting to the user's microphone and opening the Finder window. Opening Finder takes up to 30 seconds to actually open it and microphone hangs whenever I try to start it.

    We use the code below to open the Finder Window

    System.Diagnostics.Process p = System.Diagnostics.Process.Start("open", $"\"{macPath}\"");


    It eventually opens the Finder window, but only after 10-30 seconds. Meanwhile, a MacOS process called "tccd" kicks in causing the CPU to spike.

    For Microphone, we use Unity's built-in Microphone class and we get hangs that last for 15-50 seconds. Same thing happens where the "tccd" process kicks in and spikes our CPU.

    When we try to connect to the microphone the first time the OS asks us once if we want to allow the app to access the microphone, but it always hangs even after confirming. It never asks us about accessing Finder.

    It seems like the MacOS is actively trying to slow us down from accessing these, but not completely stopping us, as Finder eventually opens and the microphone eventually connects (sometimes). We do not have these problems on Windows, it's only on MacOS. Any thoughts as to what is happening?

    Note: There are no problems in Editor, only in Mac builds
     
    Last edited: Jul 31, 2019
    User340 and JoeStrout like this.
  2. OscarCybernetic

    OscarCybernetic

    Joined:
    Sep 12, 2018
    Posts:
    23
    We found the problem. Our code had to be signed in order to use it on a Mac. Now that the app is signed, we have access to everything we need as listed in our entitlements file
     
    JoeStrout likes this.
  3. User340

    User340

    Joined:
    Feb 28, 2007
    Posts:
    3,001
    Does it need to be signed even if it's standalone (outside of the mac app store)? My app is running pretty good without being signed.
     
  4. OscarCybernetic

    OscarCybernetic

    Joined:
    Sep 12, 2018
    Posts:
    23
    In our case, our app is pretty big (roughly 1.5 GB) so the security system that MAC uses (tccd) would kick in and it seems like it tries to scan the whole app whenever we tried to use the microphone or access finder. Since the app is so big, this led to hangs of up to 30 seconds. Smaller apps won't have this problem because they're scanned much faster. This is all just speculation on my part, but that's what the evidence has led me to believe.

    Note: We made a new Unity project using just 1 script to access the microphone and the security system kicked in but ran fine anyway since the project was so small

    tl;dr. As long as your app is relatively small, it probably doesn't have to be signed, but don't take my word for it
     
    patrickgh3, JoeStrout and User340 like this.