microsoft / MixedReality-HolographicRemoting-Samples

Code samples for using Microsoft's Holographic Remoting library.
Other
141 stars 47 forks source link

Unity Play Mode with Holographic Remoting---Failed to enable remoting runtime #58

Closed ANG0-0GNA closed 1 year ago

ANG0-0GNA commented 2 years ago

I want to use Holographic Remoting to stream holographic content to HoloLens 2 in real time. I follow this tutorial to preview my work with Holographic Remoting. But when I click the 'play' button in unity, I get this error in unity

Failed to enable remoting runtime. UnityEngine.Debug:LogError (object) Microsoft.MixedReality.OpenXR.Remoting.PlayModeRemotingPlugin:HookGetInstanceProcAddr (intptr) (at Library/PackageCache/com.microsoft.mixedreality.openxr@a4cc3ecd3f67/Runtime/FeaturePlugins/PlayModeRemotingPlugin.cs:77) UnityEngine.XR.Management.XRGeneralSettings:AttemptInitializeXRSDKOnLoad () (at Library/PackageCache/com.unity.xr.management@4.2.0/Runtime/XRGeneralSettings.cs:148)

The Holographic Remoting App in Hololens2 had no response. It seems to be a problem in unity. This figure shows my setting and versions of unity (v2020.3.34), openXR plugin (v1.4..2), Mixed Reality OpenXR Plugin (v1.4.0). How can I solve it? Thanks for your help! This figure

Hanaae-MSFT commented 2 years ago

Hey @ANG0-0GNA, we are currently looking into it.

Hanaae-MSFT commented 2 years ago

Hey @ANG0-0GNA, Unfortunately, we were not able to reproduce the issue on our side with Unity 2020.3.34 and the mentioned versions of plugins. Thus, we kindly ask you to send us a super minimal version of your project so we can take a closer look. Also, please make sure to have visual studio runtimes installed.

ANG0-0GNA commented 2 years ago

@Hanaae-MSFT Hi, I try again on another computer with the same windows version and the Holographic Remoting and Play mode can work. I copy this project to my computer and it doesn't work again. Same error happens.

Moreover, the project has no extra assets. I just follow the tutorial (https://docs.microsoft.com/en-us/windows/mixed-reality/develop/unity/preview-and-debug-your-app?tabs=openxr) to import Mixed Rreality OpenXp Plugin and MRTK foundation using the Microsoft Mixed Reality Feature Tool.

I don't know what caused this error. You mentioned the visual studio runtimes. Is it installed in VS? or in Unity? I have installed .Net 5.0 Runtime in VS 2019. But for Holographic Remoting and Play mode, it seems that we don't need VS2019 to build the project. All the operations are in unity. Thanks!

ANG0-0GNA commented 2 years ago

Hi @Hanaae-MSFT, My unity hub has this problem, so I need open unity hub as administrator to solve this problem. I suspect there is a connection between this problem and my holographic remoting problem. I try to solve this problem and after it was solved, the Holographic Remoting and Play mode can work!!

I follow these steps to solve the unity hub problem:

  1. Set the %TEMP% and %TMP% in user variables of Environment Variables from %USERPROFILE%\AppData\Local\Temp to %USERPROFILE%\AppData\Local\Temp; %SystemRoot%\TEMP. Then run the unity hub, but it will not work.
  2. Change the %TEMP% and %TMP% back. Then run the unity hub again, it can work without administrator.

Then when I open the same project, Holographic Remoting and Play mode can work. I don't know the reason........

I did something, but finally, none of the settings have changed. Do you have any ideas? Thanks for your help!!

yl-msft commented 2 years ago

@ANG0-0GNA , I believe this is related to that you are running Unity.exe as administrator. The MR openxr plugin currently cannot load remoting runtime when the XR app (in this case, for play mode remoting, it's the unity.exe editor) is running with elevated privilege.

We've received a few reports related to running remoting openxr plugin in elevated app, and we are planning to do something to make this easier. but in the meantime, you need to find a way to run your Unity editor without elevation.

AaronTaube commented 2 years ago

I am currently experiencing the same issue when running from an Azure VM. Works fine from a local desktop, even when remoting to a public IP rather than the local one, but cannot get past the Failed to enable remoting runtime error on the VM. VM does support h.264 encoding. Tried multiple versions of Unity, am currently running it on 2020.3.37. OpenXR 1.4.3. *May have a fix, will update it here soon if confirmed.

So going to go ahead and drop part of it, as this has thus far fixed most of my issues, but when you create a VM in Azure and use it for development and Holographic Remoting the default administrator account will run everything as an administrator always, so I had to create a separate user account with lower privilege just to run Unity not in elevated privilege.

yl-msft commented 1 year ago

@ANG0-0GNA @AaronTaube , @Hanaae-MSFT , With the latest MR openxr plugin 1.6.0 release, we properly support remoting app running in admin mode. Could you please try your scenario after integrating 1.6.0 plugin?

Here's the 1.6.0 release note:

Supports running Holographic Remoting remote app in elevated process.

lappelsmeier commented 1 year ago

Closing for now on our side too since the release mentioned above should fix the issue. Let us know if you still have problems.