hl2ss icon indicating copy to clipboard operation
hl2ss copied to clipboard

[Feature Request] Run Hololens application within Unity editor without Hololens

Open Zulex opened this issue 2 months ago • 4 comments

Thanks for the excellent work.

I've used hl2ss in previous scientific research (and cited it) and now want to add custom logic to the application that requires bidirectional communication. However, I’m unable to connect to the application when it runs in the Unity Editor without a HoloLens connected.

Would it be feasible to enable this? I understand that sensor data wouldn’t be available in that case.

From what I can tell, the main obstacle lies in the #if WINDOWS_UWP blocks, particularly around DLL import in the Hl2ss.cs script. When these are skipped, most methods become empty methods. It looks like a substantial structural change or DLL revision would be required to make this work, unless I’m missing something. The error I'm receiving when trying it, is that the machine seems to actively refuse the connection (firewall is even put off)

The main reason for wanting this feature is to have faster development iterations when just wanting to test if messages arrive as expected.

Zulex avatar Oct 06 '25 14:10 Zulex

Hi, I extracted the hl2ss message queue code and built a separate x64 plugin that can run in the Unity Editor. I also removed the #if WINDOWS _UWP block. I tested it and it seems to work OK. The Unity project with the new plugin is the mqxst_test branch https://github.com/jdibenes/hl2ss/tree/mqxst_test/hl2ss_unity

jdibenes avatar Oct 08 '25 07:10 jdibenes

Thanks @jdibenes !

It's working now. There's an annoying behavior that Unity freezes when getting out of play mode before stopping the client, but it is not a major issue. I thought this happened because if OnApplicationQuit behavior and changed it to OnDisable, but it did not fix it. However, it works for my purposes, thanks!

If there is a way I can thanks/support you via a i.e. Patreon, please let me know. Issue can be closed afterwards.

Zulex avatar Oct 13 '25 13:10 Zulex

I did not test that, oops. Added a new version of the plugin that does not freeze when leaving play mode before stopping the client.

jdibenes avatar Oct 13 '25 20:10 jdibenes

Seems to work; thanks again! Issue can be closed and feel free to drop a patreon :)

Zulex avatar Oct 22 '25 20:10 Zulex