jdibenes / hl2ss

HoloLens 2 Sensor Streaming. Real-time streaming of HoloLens 2 sensor data over WiFi. Research Mode and External USB-C A/V supported.
Other
212 stars 53 forks source link

Getting NullReferenceException when trying to build and run the Unity sample project #102

Open fmatulic opened 5 months ago

fmatulic commented 5 months ago

I'm getting a NullReferenceException error in your BuildPostProcessor script when I try to build and run your sample Unity project. Here's the full trace:

NullReferenceException: Object reference not set to an instance of an object
BuildPostProcessor.AddCapability (System.Xml.XmlDocument xml, System.String name, System.String capability, System.String namespaceURI, System.Boolean append) (at Assets/Editor/BuildPostProcessor.cs:12)
BuildPostProcessor.OnPostprocessBuild (UnityEditor.BuildTarget target, System.String pathToBuiltProject) (at Assets/Editor/BuildPostProcessor.cs:33)
System.Reflection.RuntimeMethodInfo.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at <b11ba2a8fbf24f219f7cc98532a11304>:0)

Looking in the BuildPostProcessor script, it appears it can't find the "Capabilities" tag in "Package.appxmanifest" and indeed when I open the file that tag is absent. Adding it manually solved the problem, but maybe you want to add that in your BuildPostProcessor script.

Ok, but now I have another problem. After the application starts on the HoloLens, a movements access permission window is briefly shown along with what looks like the MRTK's visual profiler and then the application suddenly quits.

jdibenes commented 5 months ago

Hello, What Unity version are you using?

fmatulic commented 5 months ago

Sorry for forgetting to mention that piece of info. I'm on Unity 2022, which I know isn't the version you used for the project.

jdibenes commented 5 months ago

I tried building the Unity sample on Unity 2022. Enabling Sync Capabilities in Project Settings > Player > Publishing Settings fixes the NullReferenceException error and the app seems to run correctly on the HoloLens.