Hololens 2#

Summary#

The Hololens 2 is an AR device meant for professionals, running the Windows Holographic OS.
One can code in C++ by using a dedicated API, or through Unity.

Set up#

Please follow this link to set an account on the Hololens.
Once done, you can register your iris to automatically connect to your account once the headset put on your head.

Note

The group does not have a universal SPL account setup yet.

Note

In case the holograms seem to be buggy or jumping around, please ensure the cameras and the inner glasses are clean. If the device cannot track your eyes or the environment correctly, the experience may be disrupted.

Also, too many apps may be running in the background. To close them, either reboot the Hololens, or connect through its IP and access the Device Portal to force them shut.

Develop (Unity)#

Note

Beforehand, ensure that the correct tools and add-ons are installed. Also, the developer mode must be enabled.

Once the project has been tested, it can then be compiled and deployed on the device in a simple manner. Access File -> Build Settings:

Unity build settings

Build settings#

Ensure that the platform is the Universal Windows Platform (else select it and click Switch Platform).

Note

If the build fails, the error messages can be seen under the Console panel,

Through USB#

Click on Build and create and select a build folder.
Then open the generated .sln project through Visual Studio.
Set the solution to Release and platform to ARM or ARM64 and target to Device. Then select the UWP solution (normally as default) and try to run.
Unity USB build

USB build#

Note

The device is not paired at first. Visual Studio will guide you to pair it by asking for a developer code. Under the Hololens, go to Settings -> Update & Security -> For developers and click on Pair.

Through WiFi#

The project can be deployed directly from Unity through the Device Portal.
Select Remote device, then enter the Hololens IP under Portal Address. The name and password are those linked to the headset, i.e. the one used to connect directly to it through the IP.
If logged in the Hololens, it is possible to reset the username and password by failing multiple times to connect to the device through a PC by its IP.
The default username and password can be found under the Notion inventory.

Note

You can retrieve the Hololens IP by saying What's my IP ? while wearing the headset.

The build directly from Unity will not work if the device portal system is not working under the PC. At the time of writing, Sinf’s PCs are not up to date enough to enable it.

To get it working through Visual Studio, open the .sln project and select Remote Machine as target. Click on the right of it to develop the list then {ProjectName} Debug Properties -> Debugging -> Machine name -> enter Hololens IP. It is now possible to run the program remotely.

Deploy#

The build through Unity will deploy the app automatically.

If done through Visual Studio, stopping the program will uninstall the app. If connected by USB, it is possible to disconnect the cable without stopping the program. It will stay in memory, but of course is not the best solution …

To correctly deploy in either case, simply go under the Build tab and select Deploy solution.