Expert Import of Mixed Reality Toolkit for Unity

Expert Import of Mixed Reality Toolkit for Unity

This post aims to cover the advanced methods of importing the toolkit into your project by adding it as a submodule to your new or existing repository, then including it in your project via symbolic links.

Warning! This is an advanced topic and you can really cause damage to your project or system if you don’t fully understand what you’re doing.

What you’ll need

If you haven’t done so already, be sure you’ve properly setup your development environment.

If needed, you should download and follow the default installation instructions for the software below:

For the purposes of this tutorial I will be using the Source Tree git client.

Getting Started

If you haven’t done so already, create and initialize a new repository and create a new Unity Project.

Clone your repository, if needed.

Add a new Submodule to your repository via Repository/Add Submodule...

ProTip: You can quickly add a new Submodule in Source Tree with the context menu when hovering over the sidebar.

Copy the Mixed Reality Toolkit for Unity repository’s remote URL.

Paste it into the Source Path / URL field in the Add Submodule window, and specify a Local Relative Path.

After cloning the submodule your repository directory should include the following:

  • .git
  • .gitattributes
  • MixedRealityToolkit-Unity
  • Your Unity Root Project Folder

At this point you should stage and commit additions for the .gitattributes file and MixedRealityToolkit-Unity folder.

Now open the File Explorer to the root of your repository, if you don’t already have it open.

Open Windows PowerShell as administrator though the File Explorer menu.

Run the cmd executable in PowerShell and call mklink to create a Directory Junction:

cmd /c mklink /j "C:\<YourUnityProjectFolderPath>\Assets\MixedRealityToolkit" "C:\<YourSubmodulePath>\Assets\HoloToolkit"

 

Now open your project, and it will import and serialize the assets appropriately.

You’ll get a warning from Unity about using Symbolic Links in your project, which is normal.

Warning!
Assets/MixedRealityToolkit is a symbolic link. Using symlinks in Unity projects may cause your project to become corrupted if you create multiple references to the same asset, use recursive symlinks or use symlinks to share assets between projects used with different versions of Unity. Make sure you know what you are doing.

Next, add the newly created Directory Junction to the list of ignored folders for your repository, so you don’t add the submodules assets into your main repository.

Assets/MixedRealityToolkit/
Assets/MixedRealityToolkit.meta

 

Next, you’ll want to prepare the project for Windows Mixed Reality.

Comments are closed.