When you’re using the Mixed Reality Toolkit in your project, you’ve probably been doing the same I have been doing: install the MRTK package or copy the sources to your own project. All dll’s, scripts and resources are then copied into your project. And when you push your changes to your git repo, these sources are also stored there.

There is a way to add MRTK to your project as a git submodule. This is like a link to a specific version in another GitHub repo. And if that submodule has submodules as well, they can be retrieved in one command as well. For a simple scenario like using the MRTK using submodules is a good option.

The way to do this is to get the submodule outside of your projects assets folder and add a linked folder to that folder in your assets folder. The steps to do this are described below.

Get MRTK and setup a link to it

In the root directory of [PROJECTNAME] clone MRTK as submodule:

git submodule add https://github.com/Microsoft/MixedRealityToolkit-Unity.git

Now create a folder link in Assets to the HoloToolkit folder. Run this command from within the project folder:

mklink /j .\Assets\HoloToolkit .\MixedRealityToolkit-Unity\Assets\HoloToolkit

Next, open the project in Unity to import the MRTK. Setup the project settings using the MRTK menu [Configure – Apply Mixed Reality Project Settings]. Also set the MRTK specific scene settings using the MRTK menu [Configure – Apply Mixed Reality Scene Settings]. Now build the UWP project.

To prevent the folder link to be added to the GitHub repo, modify the .gitignore to ignore the HoloToolkit folder in the Assets folder. Add this to the file:

/Assets/[Hh]olo[Tt]oolkit*

Now you can publish to your GitHub repo.

git add .
git commit -m "[comment]"
git push

Retrieve the project with MRTK

Clone the repository of your project. The use of the –recursive flag is necessary to retrieve also all submodules.

git clone --recursive [project github url]

If this is the first time you retrieve the project on your machine, make a folder link in Assets to the HoloToolkit folder to make it available again to the project. Run this command from within the project folder:

mklink /j .\Assets\HoloToolkit .\MixedRealityToolkit-Unity\Assets\HoloToolkit

Open the project in Unity and open the main scenario. Set the project settings using the MRTK menu [Configure – Apply Mixed Reality Project Settings] and you’re done.

To see a sample project with this structure, goto https://github.com/mtirion/MRTKAsSubModule.