Author: Stephen Hodgson

Preparing Your Project for Mixed Reality

Preparing Your Project for Mixed Reality

This post will cover how to prepare your Unity Project to use the Mixed Reality Toolkit.  We will be modifying the project’s settings, and ensuring we’re all set to create our first scene.

What you’ll need

If you haven’t done so already, be sure you’ve properly setup your development environment and you’ve imported the Mixed Reality Toolkit into your project.  You’ll also need to be familiar with the Unity Editor and its interface controls.  If you are not, there is a great tutorial series to get you started.

Getting Started

Open your project and navigate to the Mixed Reality Project Settings Wizard via:

Mixed Reality Toolkit/Configure/Apply Mixed Reality Project Settings...

Next you’ll see the Project Settings Wizard.  You’ll want to enable the following options:

  • Target Windows Universal UWP
  • Enable XR
  • Build for Direct3D
  • Target Occluded Devices
    • If you’re also targeting the HoloLens, these settings will be automatically detected and updated for you when the app runs on the device
  • Use the Toolkit specific input manager axes
  • Enable .NET scripting back-end

Then press Apply.  It’ll take a moment for the editor to switch the build platform and re-import and serialize the assets.  Once finished, navigate to the Editor Build window to double check the wizard completed successfully via File/Build Settings...

ProTip: You can access the build window via Ctrl + Shift + B

Next, we will configure the scene.  Navigate to the Scene Settings Wizard via:

Mixed Reality Toolkit/Configure/Apply Mixed Reality Scene Settings...

You’ll see the Scene Settings Wizard, with all the default settings already enabled for you.  Press Apply.

In your scenes hierarchy you should now see the standard scene prefabs.

Next you’ll want to create a new folder in your project’s folder and name it the same as your project.  This folder will contain all the assets specific to your project under the Assets root folder.  Inside that folder you’ll want to create the following folders:

  • Animations
  • Materials
  • Meshes
  • Prefabs
  • Scenes
  • Scripts
  • Textures

Then save your scene in the Assets/<Your Project Name>/Scenes folder.

From here, you’re all set to start creating custom content for your project. Good Luck!

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.

Advanced Import of Mixed Reality Toolkit for Unity

Advanced Import of Mixed Reality Toolkit for Unity

This post aims to cover the more advanced methods of importing the toolkit into your project by downloading the source straight from GitHub using Git source control.

What you’ll need

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

Open Source Tree and Press the Clone button to add a new repository.

Next we need is the Mixed Reality Toolkit for Unity’s remote url, which you can find on the main repository GitHub page.

Copy the URL and paste it into your Source Path field

Once the repository has downloaded, you can quickly open to the project’s root by simply selecting the Working Copy pane and pressing Open in File Explorer

Working Copy

Next launch the Unity Editor and create a new project.

Right click the Asset folder and press Show in Explorer.

Align both File Explorer windows next to each other.

Go into the Assets Folder for each window.

In the Source Tree Clone File Explorer window, click and drag the HoloToolkit folder and it’s associated .meta file into your projects asset folder.

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

Fast and Easy Import of the Mixed Reality Toolkit for Unity

Fast and Easy Import of the Mixed Reality Toolkit for Unity

In the last post we finished setting up your development environment in preparation for creating Mixed Reality Applications.  Now let’s get to the fun part and start our project!

What you’ll need

Getting Started

Launch the Unity Editor and create a new project.

 

Once the project has loaded, you can import your downloaded asset package via Assets/Import Package/Custom Package...

Pro Tip: Simply drag and drop the asset package directly into your project window

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

Getting Started with Unity and the Mixed Reality Toolkit

Getting Started with Unity and the Mixed Reality Toolkit

Getting your development environment properly setup is critical for any venture into software development.  This tutorial aims to cover all the step by step instructions on how to get your machine into the best possible state for developing Windows Mixed Reality applications using the Unity 3d Editor and Microsoft’s open Mixed Reality Toolkit for Unity.

The Toolkit does a good job documenting all the steps for setup, but I figured going though step by step could be useful for some people.

What you’ll need

For the purposes of this Tutorial all steps below use the following software:

If later versions of the software are availible, it’s suggested you check the Mixed Reality Toolkit’s Readme and follow the instructions there.

Check your version of Windows

Windows Mixed Reality development requires you to use the Windows operating system and the latest SDKs.  You will need to running the Fall Creators Update (Version 1709, Build 16299).  If you are not running the Windows 10 Fall Creators update, then you will need to Update your version of Windows.

Pro Tip: You can check your windows version by pressing  + R and type “WinVer”

Fall Creators Update

Setting up the Environment

Once you’ve got the proper version of windows, you’ll need to tinker in the settings a bit to make sure you’re ready to start developing.  You’ll need to enable Developer Mode in the operating system settings.

Pro Tip: You can quickly find the Developer Settings by pressing  + S
and type “For Developers Settings”

Enable Developer Settings

Installing the tools

Visual Studio 2017

Follow the default installation instructions, select the following workloads:

UWP Workload
Unity Workload

Select the following Individual Components:

Visual Studio Components

You can install more workloads, components, and UWP SDK’s if you’d like.

Unity Editor

Download and install the version that targets your specific development needs.

Pro Tip: Be sure to select .NET Scripting backed

Unity Installer Options

Getting the Mixed Reality Source Code

From here, you’ve got a few different options on exactly how you’d like to get the Mixed Reality Toolkit into your project:

 Fast/Easy Import

This post covers how to download the latest Unity Package from the GitHub repository releases and import it into your project.

Advanced Import

This post covers how to clone from GitHub and copy the folders by hand into your project’s asset folder.

Git Expert Import

This post covers how to add it as a submodule to your existing repository, then include it in your project via symbolic links.

Hello World!

Hello World!

I probably should have done this years ago.

Blogging is an important part of giving back to the community of developers who in turn have helped countless others. Sharing the knowledge you’ve gleaned and experiences you’ve had is vital to helping other people continue where you’ve left off.  Science and Technology are fundamentally driven by people who share and publish their findings.

This blog will mainly cover topics in Mixed Reality, Augmented Reality, and Virtual Reality, with a scattering of random things in between.  If you’ve got a specific topic you’d like me to discuss, please feel free to ask.