Unity Crash on MacOS when the join method is invoked (Agora.io)
Asked Answered
T

3

6

I downloaded the agora.io video sdk asset from the asset store, imported it to a new project. On the demo "SceneHome" scene, I entered the api id. Clicked play, and as soon as I click the "join" button Unity crashes. As far as I can tell the crash happens on the

app.join(field.text);

line in the TestHome.cs script (line #86).

I tested it in 2019.3.2f1 and 2020.1.0b5. The result was the same. The OS is Catalina 10.15.4.

The demo works on Windows.

I followed this tutorial: https://medium.com/@jake_agora.io/mac-run-video-chat-within-your-unity-application-e001091db62f but used x86_64 dlls instead of x86

Does anyone know what this is about? Or where should I begin to look?

Another tutorial, this one from Agora:

https://www.agora.io/en/blog/run-video-chat-within-your-unity-application-mac

Takin answered 16/4, 2020 at 17:7 Comment(5)
Why would anyopne downvote this critical question?Illusionary
@Illusionary didn't vote at all but it would probably be nice to add the according code so we don't have to Import the package just to look into it ;)Chrono
hola @Chrono ! hope you re well. hmm, the line of code is right there (I just now edited it so it is highlighted)Illusionary
@Illusionary yes thx ;) But I mean e.g. what is app? And what does join do? Also what is field (though it looks like an UI.InputField)?Chrono
@Chrono this question was about a specific asset, Agora.io. And the code is from the example in the asset. I probably should have specified exact version of the asset so people could download and refer that...Takin
T
2

As herve nau pointed out the problem was that the Unity did not had the permission to use camera or microphone. And the solution should work. Alternatively, here is another way to add the permission as described by launzone:

1) Disable SIP: Go into recovery mode (hold CMD+R when you

restart your Mac) Don't be afraid, we are not doing anything crazy.

2) After that open Terminal (it should be accessible from one of the Menus at the Top) Type in "csrutil disable" and hit enter. Then reboot your Mac normally.

3) Open Terminal and type in: "sqlite3 ~/Library/Application\ Support/com.apple.TCC/TCC.db" and hit enter

4) For microphone access, type in: "INSERT INTO access VALUES('kTCCServiceMicrophone','com.unity3d.unityhub',0,1,1,NULL,NULL,NULL,'UNUSED',NULL,0,1541440109);" and hit enter

For camera, type in: "INSERT INTO access VALUES('kTCCServiceCamera','com.unity3d.unityhub',0,1,1,NULL,NULL,NULL,'UNUSED',NULL,0,1541440109);" and hit enter

6) check in your SystemPreferences/Security&Privacy > unity hub should now show up in both mic and cam

7) reboot in recovery mode again (CMD+R), open terminal again, type in: "csrutil enable" and hit enter, to enable SIP again

8) reboot normally and enjoy!

Here is the full thread. I hope it helps someone :)

Takin answered 27/4, 2020 at 11:17 Comment(1)
Wow, that's very hacky. Thanks for sharing the info!Unheardof
U
4

It can be caused by missing the Camera and Microphone usage in the Unity Editor project setting. Please let us know if that's the case. (I saw you are also on the Slack channel, let's continue the conversation there.).

enter image description here

For the people who didn't know, Agora Developer Community - Unity Chat channel is here :)

Unheardof answered 17/4, 2020 at 19:9 Comment(4)
Hi Rick, thanks for the key tip. You truly need to add that on the tutorial at: agora.io/en/blog/…Illusionary
The instruction is included in the README file bundled with the SDK. Hope you can make use of that.Unheardof
Good one Rick - that's useful information. (First time I've ever read a readme :) ) I sent over 250 bounty points :)Illusionary
This should be market as the right answer, thanks to a lotUtter
V
2

check if not related to the webcam registration issue on macOs with the Unity Hub running. Fix for the camera, not sure if related to your problem: Remove the Unity Hub app, then open the project directly from Unity App. May also be useful to relocate the Unity app in another folder to force the webcam usage security registration.

Made the test here, Unity 2019.3.11.f1, using the demo app, with Hub active -> crash on press of Join Button, did the Hub removal described above, rerun the same demo and no more crash at this level. Running on Catalina 10.15.2.

Veroniqueverras answered 24/4, 2020 at 13:45 Comment(0)
T
2

As herve nau pointed out the problem was that the Unity did not had the permission to use camera or microphone. And the solution should work. Alternatively, here is another way to add the permission as described by launzone:

1) Disable SIP: Go into recovery mode (hold CMD+R when you

restart your Mac) Don't be afraid, we are not doing anything crazy.

2) After that open Terminal (it should be accessible from one of the Menus at the Top) Type in "csrutil disable" and hit enter. Then reboot your Mac normally.

3) Open Terminal and type in: "sqlite3 ~/Library/Application\ Support/com.apple.TCC/TCC.db" and hit enter

4) For microphone access, type in: "INSERT INTO access VALUES('kTCCServiceMicrophone','com.unity3d.unityhub',0,1,1,NULL,NULL,NULL,'UNUSED',NULL,0,1541440109);" and hit enter

For camera, type in: "INSERT INTO access VALUES('kTCCServiceCamera','com.unity3d.unityhub',0,1,1,NULL,NULL,NULL,'UNUSED',NULL,0,1541440109);" and hit enter

6) check in your SystemPreferences/Security&Privacy > unity hub should now show up in both mic and cam

7) reboot in recovery mode again (CMD+R), open terminal again, type in: "csrutil enable" and hit enter, to enable SIP again

8) reboot normally and enjoy!

Here is the full thread. I hope it helps someone :)

Takin answered 27/4, 2020 at 11:17 Comment(1)
Wow, that's very hacky. Thanks for sharing the info!Unheardof

© 2022 - 2024 — McMap. All rights reserved.