The application should implement real-time or user-created maps and visualize content, such as moving vehicles, people (or animals), points of interest etc. For example: a tactical military sandbox, an interactive park map, a guide map of an airport, etc.
- Unity Engine (2020.3.19f1 LTS)
- Visual Studio Community 2019 (16.11.5)
- Microsoft HoloLens 2
- HoloLens 2 Emulator (if the device is unavailable)
When installing Visual Studio 2019, make sure you have the following workflow packages installed:
- Desktop development with C++
- Universal Windows Platform development
- Game development with Unity
- Download the Mixed Reality Feature Tool: https://www.microsoft.com/en-us/download/details.aspx?id=102778
- Download and import the MRTK Unity packages: https://github.com/Microsoft/MixedRealityToolkit-Unity/releases
- Import the MRTK Unity packages into a new 3D Unity project:
- Microsoft.MixedReality.Toolkit.Unity.Foundation.2.7.2.unitypackage
- Microsoft.MixedReality.Toolkit.Unity.Extensions.2.7.2.unitypackage
- Microsoft.MixedReality.Toolkit.Unity.Examples.2.7.2.unitypackage
- Microsoft.MixedReality.Toolkit.Unity.Tools.2.7.2.unitypackage Note: You can also import those packages using the Mixed Reality Feature Tool desktop application, then import them into the project using the Package Manager in Unity.
- Go to File → Build Settings and switch the platform to “Universal Windows Platform”
- Go to Project Settings → XR Plug-in Management, select the Universal Windows Platform settings tab and select the following options:
- OpenXR
- Microsoft HoloLens feature group
- Windows Mixed Reality (if possible)
- Go to Project Settings → XR Plug-in Management → Open XR and set the following options:
- Render Mode = “Single Pass Instanced”
- Depth Submission Mode = “Depth 16-Bit”
- Go to Project Settings → Player → Publishing Settings → Capabilities and make sure the following are selected:
- Microphone
- SpatialPerception
- InternetClient
- Webcam
- Location
- Objects3D
- GazeInput
- Go to Project Settings → Player → Publishing Settings → Supported Device Families and make sure the following are selected:
- Mobile
- Holographic
Once you are ready to build the project, follow these steps:
- Go to File → Build Settings and add all the required Scenes
- Navigate to Mixed Reality → Toolkit → Utilities → Build Window
- In Unity Build Options:
- Set the Target Device to “HoloLens”
- In Appx Build Options:
- Set Build Configuration to the required type (Default: Master)
- Set Build Platform to “ARM64”
- Set Platform Toolset to “Solution”
- Change the Version Number if necessary
- Click “Build All” once all the build options are set
Once you are ready to build the project, follow these steps:
- Go to File → Build Settings and add all the required Scenes
- In Build Settings:
- Target Device => “HoloLens”
- Architecture => “ARM64”
- Build Type => “D3D Project”
- Target SDK version => “Latest installed"
- Minimum Platform Version => choose the smallest value (usually the first on the list)
- Visual Studio Version => “Latest installed”
- Build an Run on => “Local Machine”
- Build Configuration => “Release” (or Master)
- Click “Build” once all the build options are set
- Once the project has been built, open the project solution (.sln) in Visual Studio 2019
On Visual Studio 2019:
- In the Solution Explorer, right-click on the Project [AR-Maps (Universal Windows)] → Publish → Create App Packages…
- Select distribution method => Sideloading
- Select signing method => Yes, use the current certificate: …
- Select and configure packages => choose [ARM64, Release (ARM64)]
- Click “Create” to build and export the project into an Appx package.
- On the Windows Device Portal, navigate to Views → Apps → Deploy Apps and choose the application file you wish to install on the HoloLens 2.
- The app package can be found with the file format (.appx) in the following directory: \AppPackages<AppName><AppName>_1.0.0.0_ARM64_Test<AppName>.appx
- Click “Install” and it will be available in the HoloLens 2’s app menu
To run the app on the HoloLens, you have to configure the following settings: On HoloLens 2:
- Open the Holographic Remoting app (It can be downloaded from the Windows Store on the device)
In Unity:
- Go to Mixed Reality → Remoting → Holographic Remoting for Play Mode.
- In Remote Host Name, add the HoloLens 2 device’s IP address which is displayed on the Holographic Remoting app.
- Set the Remote Host Port to “8265”
- Click on Enable Holographic Remoting for Play Mode.
Once you click Play, the Holographic Remoting app on the HoloLens 2 should show “Receiving...” for a moment, and then display the app.
- You may need to allow the permissions that pop up before running the app.
For more details, refer to this video: https://youtu.be/XlzM1uRSkns
For files that have an error related to this:
error CS0104: 'Description' is an ambiguous reference between 'Mapbox.VectorTile.Geometry.DescriptionAttribute' and 'System.ComponentModel.DescriptionAttribute'
Comment out the following line:
using Mapbox.VectorTile.Geometry;
from the following files:
- Assets\Mapbox\Core\mapbox-sdk-cs\MapMatching\MapMatchingParameters.cs
- Assets\Mapbox\Core\mapbox-sdk-cs\Tokens\MapboxTokenApi.cs
For errors related to the MapboxAccounts:
Assets\Mapbox\Unity\MapboxAccess.cs(1,7): error CS0246: The type or namespace name 'MapboxAccountsUnity' could not be found (are you missing a using directive or an assembly reference?)
Assets\Mapbox\Unity\MapboxAccess.cs(332,27): error CS0246: The type or namespace name 'MapboxAccounts' could not be found (are you missing a using directive or an assembly reference?)
Error building Player because scripts had compiler errors
Go to Assets/Mapbox/Core/Plugins/Mapbox/MapboxAccounts/net4x/MapboxAccountsUnity.dll in Unity and check the WSAPlayer checkbox in the Inspector and click on “Apply”.