This Unity plugin makes the HoloLens video camera frames available to a Unity app in real time. This enables Unity devs to easily use the HoloLens camera for computer vision (or anything they want).
This Unity plugin makes the HoloLens video camera frames available to a Unity app in real time. This enables Unity devs to easily use the HoloLens camera for computer vision (or anything they want).
Use this if you need access to the HoloLens camera's frame buffer in Unity, including the locatable camera attributes.
The tutorials below will show you how to build the plugin (DLL) or run the Unity sample app.
There are two separate "solutions" (if you will) in this repository:
The plugin solution has two projects. One is the actual library project, and the other is a "dummy" or "placeholder" project that is used to keep the Unity editor from complaining (more info here). The placeholder project doesn't do anything, it just mimics the plugin's public API. To build the solution (including both projects), follow the steps below:
HoloLensCameraStream/HoloLensCameraStream/HoloLensCameraStream.sln
.If you made some changes to the plugin project, and you want to use your newly-built DLLs, follow these steps. If you haven't made changes to the plugin, but just want to learn how to use the CameraStream plugin in Unity, skip this part and read instead about running the example project.
Assets/Plugins/WSA/
directory in your Unity project because it will only compile for WSA devices.Assets/Plugins/
directory in your Unity project. This is the DLL that the Unity editor compiles against uses while you're coding in Unity.HoloLensCameraStream.dll
plugin file that you pasted in step 2. In the inspector, uncheck all platforms except WSAPlayer
. Set the SDK to UWP
, and set the Scripting Backend to Dot Net
. In the Placeholder dropdown, select the HoloLensCameraStream.dll
option (it will likely be the only option).Assets/Plugins/HoloLensCameraStream.dll
. Uncheck all platforms except Editor
.You should now be able to code against the HoloLensCameraStream plugin after importing said namespace in your Unity scripts. Note: Your Unity project needs to be appropriately configured for HoloLens development.
The example Unity project can be found in the root HoloLensVideoCaptureExample/
directory. This Unity project is a great way to learn how to use the CameraStream plugin in Unity, or to use as a template for your own Unity project. Read on to learn how to build and run the example project on your HoloLens. You should be familiar with creating and configuring a new Unity-HoloLens project according to Microsoft's instructions. As Microsoft and Unity update their HoloLens documentation, I'm sure this tutorial will become out of date.
HoloLensVideoCaptureExample/
) in Unity.Windows Store
. Set the SDK to Universal 10
; set Target device to HoloLens
; set UWP Build Type to D3D
; check the Unity C# Projects checkbox; and finally, click Switch Platform.App
, which should live as a sibling next to the Assets
folder. Then click Select Folder to generate the VS solution in that folder. Then wait for Unity to build the solution.App/HoloLensVideoCaptureExample.sln
. This is the solution that ultimately gets deployed to your HoloLens.ARM
to x86
; Change the deploy target (the green play button) to Device
(if your HoloLens is plugged into your computer), or Remote Machine
(if your HoloLens is connected via WiFi).If you have questions, check out the FAQ.
We would love for you to contribute to this project. Take a look at the TODO list in the Plugin's solution, or look at the Issues tab on GitHub to see how you can contribute. Thanks, enjoy!