microsoft / MixedReality-QRCode-Sample

A single repository of Mixed Reality samples in Unity.
MIT License
101 stars 30 forks source link

The sample doesnt work with standalone remoting app with Hololens 2 #19

Open SitronX opened 1 year ago

SitronX commented 1 year ago

Overall

It is impossible to use this sample project in Remoting standalone app mode build for Windows while remoting to Hololens 2. In Unity editor, everything works fine.

To Reproduce

It can be easily reproduced just by building the sample project targeting Windows standalone x64 and launching it. It will always give this error on start or anytime there is an attempt to initialize the QR code tracking vcrt

The error is the same also when remoting is correctly setup in the project and QR setup is only launched after the headset is succesfuly connected to the app on pc.

I have tried to temporarily include all necessary dlls in Windows environment path, which fixed the first error, but subsequently it gives the following error.

NotImplementedd

I have also tried to build the project with Il2CPP to find out if the issue is not only on Mono, but it is unbuildable on both pcs i tried it on. I should have all neccessary things for Visual Studio installed, i even added bunch of old optional stuff from Visual studio installer/Desktop development with C++ section that i figured could be linked to this problem, but no luck. I also build relatively often with Il2CPP and never had build issue like this.

image

I have Microsoft Visual C++ installed from 2005 all the way to 2022 image

I have tried every solution on both different computers, both give the same results.

Due to issue being with something with WinRT library, i have tried also OpenXR branch, which unfortunately gives the same errors. To me it appears there might be something wrong with how the QR tracking is linked to WinRT.

In Editor, there are these two special scripts to initialize important dlls on project start image image

Might this be a reason why everything works in Editor, but not in build?

Is there any known solution how to get QR code tracking working while Remoting to Hololens 2 from Standalone Windows app?

SitronX commented 1 year ago

I managed to get it working thanks to this closed issue. The main culprit in my case was that the MonoSupport.dll associated with Microsoft.Windows.MixedReality.DotNetWinRT was previously completely missing from my build. Defaultly MonoSupport.dll isnt included in standalone build and must be aditionaly setup to be included, and is very easy to miss. Previously in my project, i had it installed with package manager so it was in completely different location, only when i installed it as nugget and it was together with other dlls i noticed that.

I will leave this issue open, because i still think the project should work correctly with all dlls in plugins folder in build, so dlls relocating or including them in Environment path is not needed and i think this sample project should also contain already mentioned Microsoft.Windows.MixedReality.DotNetWinRT nuget installed here and also setup to be included in build. It is otherwise unnecessary time sink for people in the future trying to figure out what is cause of the issue.

Jx941206 commented 1 year ago

Hello! I come from China, my name is Jiang Xu. Have you solved this problem?

SitronX commented 1 year ago

The problem is not solved. But workaround mentioned above works. So you will have to manually copy these specific DLLs files to root folder after every build to not get any errors.

Jx941206 commented 1 year ago

Hello! Thank you very much for your help. Is it convenient to ask which specific DLLs are there?

SitronX commented 1 year ago

The previous issue i mentioned lists these DLLs, there is a picture. The change of code that previous issue talks about wasnt needed in my case. Only copying these DLLs solved problems.

Jx941206 commented 1 year ago

I am using the OpenXR branch and the unity version 2020. Is the solution the same? Can you be more detailed? Thank you very much for your help. This problem has been bothering me for several months. In addition, what version of Unity are you using? 微信图片_20230328080131

Jx941206 commented 1 year ago

The exe program I packaged cannot find MonoSupport.dll

Jx941206 commented 1 year ago

Hello! I want to make a friend with you! I would also like to ask you a question about how to achieve a third person perspective through two HoloLens2

SitronX commented 1 year ago

I am using 2020.3 version also with OpenXR branch. It is important to have Holographic remoting remote app and Mixed reality features checked, from your image you should be alright. The remoting should be also correctly setup. Here is the sample repo with remoting.

The MonoSupport.dll is trickier, you have to install Microsoft.Windows.MixedReality.DotNetWinRT NuGet, after installation it will be there together with other dlls.

Third person perspective with two Hololens2, like multiplayer? I havent worked with multiplayer, there are some tutorials out there using Photon, like this? But that is offtopic from the issue.

Jx941206 commented 1 year ago

Thank you very much for your answer, I have based on your project

"FnO Hololens2 visualization" solves my problem, but the reason is not yet clear.

Jx941206 commented 1 year ago

Third person perspective with two Hololens2. Two people wearing HoloLens 2 can see the same scene and both can control the objects inside

SitronX commented 1 year ago

Well good you got it working.

Third person perspective with two Hololens2. Two people wearing HoloLens 2 can see the same scene and both can control the objects inside

As i said a havent worked with multiplayer yet, so i cant really help. But please keep the discussion with the topic of this issue. This issue is not multiplayer related, this is for another thread. The remoting is for single user only.