EnoxSoftware / HoloLensWithOpenCVForUnityExample

HoloLens With OpenCVforUnity Example (Support for Hololens1 and Hololens2)
MIT License
262 stars 50 forks source link

NullReferenceException error within WindowsMixedRealityToolkit #21

Closed yllew closed 1 year ago

yllew commented 4 years ago

I followed the setup instructions 1-7. Then, I connected my Hololens through Window > XR > Holographic Emulation > "Remote to Device". However, when I press Play in Unity, it seems that the application is not connected to Hololens and instead access my PC's webcam. The following NullReferenceException error occurs.

NullReferenceException: Object reference not set to an instance of an object Microsoft.MixedReality.Toolkit.WindowsMixedReality.WindowsMixedRealityCameraSettings.InitializeReprojectionUpdater () (at Assets/MixedRealityToolkit.Providers/WindowsMixedReality/WindowsMixedRealityCameraSettings.cs:101) Microsoft.MixedReality.Toolkit.WindowsMixedReality.WindowsMixedRealityCameraSettings.Enable () (at Assets/MixedRealityToolkit.Providers/WindowsMixedReality/WindowsMixedRealityCameraSettings.cs:46) Microsoft.MixedReality.Toolkit.BaseDataProviderAccessCoreSystem.Enable () (at Assets/MixedRealityToolkit/Services/BaseDataProviderAccessCoreSystem.cs:39) Microsoft.MixedReality.Toolkit.CameraSystem.MixedRealityCameraSystem.Enable () (at Assets/MixedRealityToolkit.Services/CameraSystem/MixedRealityCameraSystem.cs:154) Microsoft.MixedReality.Toolkit.MixedRealityToolkit+<>c.b__62_0 (Microsoft.MixedReality.Toolkit.IMixedRealityService service) (at Assets/MixedRealityToolkit/Services/MixedRealityToolkit.cs:934) Microsoft.MixedReality.Toolkit.MixedRealityToolkit.ExecuteOnAllServices (System.Collections.Generic.IEnumerable1[T] services, System.Action1[T] execute) (at Assets/MixedRealityToolkit/Services/MixedRealityToolkit.cs:1024) Microsoft.MixedReality.Toolkit.MixedRealityToolkit.ExecuteOnAllServicesInOrder (System.Action`1[T] execute) (at Assets/MixedRealityToolkit/Services/MixedRealityToolkit.cs:1010) Microsoft.MixedReality.Toolkit.MixedRealityToolkit.EnableAllServices () (at Assets/MixedRealityToolkit/Services/MixedRealityToolkit.cs:934) Microsoft.MixedReality.Toolkit.MixedRealityToolkit.OnEnable () (at Assets/MixedRealityToolkit/Services/MixedRealityToolkit.cs:620)

I've searched around and most solutions suggest fixing NullReferenceException error by changing the script contents but I am not sure if I am supposed to do that since the scripts are downloaded as a part of Microsoft's Mixed Reality Toolkit. Any ideas on how to fix this problem? I am trying to get the app to run on the Hololens instead of using my PC's Webcam.

EnoxSoftware commented 4 years ago

I have tested this example only with editor and device installation. Not tested with Holographic Emulation.