microsoft / MixedReality-WebRTC

MixedReality-WebRTC is a collection of components to help mixed reality app developers integrate audio and video real-time communication into their application and improve their collaborative experience
https://microsoft.github.io/MixedReality-WebRTC/
MIT License
910 stars 283 forks source link

Works in Unity editor but doesn't work in build, DLL not found. #77

Open james-carroll-bencin opened 5 years ago

james-carroll-bencin commented 5 years ago

I follow the build instructions for the whole solution and then copied the DLLs into the include unity project. Everything open and ran correctly in the editor, however when I make a non-UWP windows x64 build I get a DllNotFoundException saying that it can't find the Microsoft.MixedReality.WebRTC.Native.dll. I tried this with the mono and IL2CPP scripting backends and tried a UWP build too and still got this exception. Do you have any idea why this might be happening?

djee-ms commented 5 years ago

Hi @james-carroll-bencin,

...and then copied the DLLs into the include unity project.

You don't need to do that, this is done automatically as part of the solution build.

Did you open Unity before compiling the solution? Do you have all variants of the plugins in the Plugins/ directory? My guess is that you opened Unity, which deleted the .meta files, then you copied the DLLs, but only one variant (x64 Desktop), and Unity regenerated some default .meta files for them for the Editor. But when deploying to something else, the native DLL is not configured anymore to deploy, so is not deployed and not found. You can check the .meta files have been changed with git status; there should be no pending changes.

See about the .meta files configuration in the docs.

eanders-ms commented 5 years ago

Hello. I found a workaround for what might be the same issue. See https://github.com/microsoft/MixedReality-WebRTC/issues/82

djee-ms commented 5 years ago

I tried in UWP, no issue.

I tried in PC Standalone x86_64, and I can't even generate a correct solution; the _Data folder is created with the wrong name and in the wrong location. I reported the issue to Unity, and until that's solved I cannot try to repro the native DLL loading unfortunately.

djee-ms commented 5 years ago

Update (or lack thereof) : there is still a pending issue logged with Unity. They reproduced the _Data folder bug but I can't get any other feedback so far.

salmanmkc commented 5 years ago

Yeah, my solution to fixing all the DLL errors was to go into the solution folder that was generated form unity and find the 64-bit folder with the DLLs, then copy the ones that were missing from the 86 folder and it fixed the missing DLL issues. Although, this was in August, so things may have been fixed since then.

djee-ms commented 4 years ago

It seems that there is (another) Unity bug related to standalone deployment on PC. Indeed the DLL is copied to the wrong location. See https://forum.unity.com/threads/dll-not-found-with-standalone-app-but-works-fine-in-editor.389392/ for details. Not sure what's the plan for fixing. As a workaround you can copy the DLL manually from the *_Data\Plugins folder and paste it next to the executable.