The Mixed Reality Forums here are no longer being used or maintained.
There are a few other places we would like to direct you to for support, both from Microsoft and from the community.
The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.
For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.
If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.
And always feel free to hit us up on Twitter @MxdRealityDev.
Adapting Media API to Unity 3D for Hololens?
We were able to get the following code sample running on the Hololens.
https://github.com/Microsoft/Windows-universal-samples/blob/master/Samples/SimpleCommunication/cs/Scenario2_VideoChat.xaml.cs
The sample enables the Hololens and a Windows 10 PC to video chat. The performance looks nice with early trials. Using this UWP app as a model, would it be possible to adapt this code to the Hololens Unity pattern of development?
We appreciate any guidance or suggestions from the community.
Best Answer
-
DavidKlineMS mod
@michaelrosario,
You can definitely adapt the sample to Unity.The key things to be aware of is that Unity is not a Universal Windows Platform application and that it's c# compiler is based on an older version of .net. That said, it is not difficult to use UWP APIs in a Unity script.
I recommend wrapping the Media API code in an #if WINDOWS_UWP/#endif block so that Unity will not attempt to compile the code. You will also need to do the same thing for the required using statements.
This will mean that you cannot test the code from within the Unity editor, but it should build in Visual Studio and be runnable on your HoloLens.
Thanks!
David5
Answers
@michaelrosario,
You can definitely adapt the sample to Unity.
The key things to be aware of is that Unity is not a Universal Windows Platform application and that it's c# compiler is based on an older version of .net. That said, it is not difficult to use UWP APIs in a Unity script.
I recommend wrapping the Media API code in an #if WINDOWS_UWP/#endif block so that Unity will not attempt to compile the code. You will also need to do the same thing for the required using statements.
This will mean that you cannot test the code from within the Unity editor, but it should build in Visual Studio and be runnable on your HoloLens.
Thanks!
David