How to deploy an HL2 app (Unity) through USB or Wifi

In case you want to know step by step how to port your HL2 application to your Hololens 2 device. All considerations are in this post.

Software requierements

  • Visual Studio 2019
    • Once you install the version you need, make sure you go to “Individuals components” in Visual studio installer.
    • And install the following items:
      • Windows 10 SDK version 10.0.19041.0 or 10.0.18362.0
      • USB Device Connectivity (required to deploy/debug to HoloLens over USB)
      • C++ (v142) Universal Windows Platform tools (required when using Unity)

  • Unity (I am working with 2020.3.8f1).
    • Make sure you install Universal Windows Platform and Windows Build Support (IL2CPP)
Unity Universal Windows Platform Build Support option
  • A hololens 2 device enabled for Developer Mode.
    • Inside Hololens:
      • Settings > Update > For Developers > Enable Developer Features. Optional : Device Portal.
  • Windows 10 enabled for Development: In the computer you will be using to deploy the app, make sure you have Windows enabled for Dev by going to Settings > Update and Security > For developers > Developer Mode enabled.

Now that we have everything installed let’s see how to deploy.

Creating the app to deploy

I will create a simple app to test our deployment.

  • Create a new Unity 3d app
  • Go to File > Build settings and switch the platform options like this:
  • Once you finish and return to Unity, you will get the following notification, select YES.
  • Unity will restart and then the following popup will come up which will open up the project settings window.
  • Then select option “XR Plugin Management”, under UWP tab, install OpenXR.

To validate OpenXR configuration, click OpenXR under XR Plug-in Management and check these items:

  • Depth Submission Mode: Depth 16 Bit
  • Interaction Profiles: Microsoft Hand Interaction Profile
  • Create an empty scene. Mixed Reality > Toolkit > Add to the scene and configure.
  • Once you have your scene, select the “Mixed reality toolkit” object in the hierarchy, and in the inspector clone the “Default Mixed Reality Toolkit Configuration Profile”
  • Select the “Spatial awareness” tab and make sure it is enabled, if not, enable it. Clone the “Default Mixed Reality Spatial Awareness System Profile”.
  • Under OpenXR SDK Mesh Observer, Clone profile and > Display settings > Display Option select “Occlusion”

Deploying HL2 App through USB

Once you have your application ready:

  • Go to File > Build Settings > Build (Select a folder where you will store the sln).
  • Open the solution with VS2019.
  • Make sure the Universal Windows App is selected as default. Then indicate you want a Release, under ARM64, and to Device.
  • Then select in menu Debug > Start Debugging or press F5. Visual studio will then ask for a Pairing Pin.
  • Inside Hololens , you can go to Settings > Update > For Developers > Under Device discovery > Pair. A number will popup, put that number inside VS2019.
Using the Windows Device Portal - Mixed Reality | Microsoft Docs
  • Congrats! Your application is deployed.

Deploying HL2 App trough Wi-Fi

Once you have your application ready:

  • Go to File > Build Settings > Build (Select a folder where you will store the sln).
  • Open the solution with VS2019.
  • Make sure the Universal Windows App is selected as default. Then indicate you want a Release, under ARM64, and to Remote Machine.
  • Go to Project > Properties > Configuration Properties > Debugging and put the IP of Hololens inside Machine Name field (it’s recommendedto put it manually)

Enjoy!

One thought on “How to deploy an HL2 app (Unity) through USB or Wifi

Add yours

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Blog at WordPress.com.

Up ↑

Create your website with WordPress.com
Get started
%d bloggers like this: