The Mixed Reality Toolkit Quick start
Getting started with any new project / framework or toolkit can be quite daunting, especially when that toolkit has such a wide reach, like the Mixed Reality Toolkit.
The last post gave you a taste for what the project was about, it's goals, aims and dreams.
What's covered in this quick start?
In this short guide, we're going to give you a quick 10 minute rundown for what is takes to get off the ground with the Mixed Reality Toolkit.
This is just a quick start, so we won't go in to too much depth in to building an entire project or all the systems available. Those will be covered later.
We will cover:
- The prerequisites you will need to get started:
- Starting a new project
- Importing the MRTK Beta asset
- Setting up your scene
- Demo of "ready to go" features
- Adding interactivity and collision
- Watching paint dry
The MRTK just needs Unity 2018.2.13f+ and the latest package available on the site and you are up and running
Starting your new project
Every Unity developer by now knows how to create a new project, but with Unity 2018, you have a few more project templates to choose from:
Of these, only the following templates are supported by the Mixed Reality Toolkit today (no dates have been suggested as to when the SRP will be supported as yet):
- 2D (although that is a bit flat for VR isn't it?)
- 3D With Extras (as demonstrated in the video)
Once you have your project open, we can start adding the MRTK to it.
Downloading the MRTK
The team are working hard on multiple delivery mechanisms for the Mixed Reality Toolkit.
- Downloadable asset from the MRTK GitHub Site - Recommended
- Unity NuGet delivery (Coming soon)
- Unity Package Manager (Coming as soon as Unity start accepting third party packages)
- Unity Asset Store (Awaiting RTM)
- GitHub submodules - Stephen Hodgson has a great guide for getting direct access to the latest source in your Unity project here
Once it's downloaded, it is ready to start importing.
Importing the MRTK
Like any other Unity asset, you can simply import the downloaded ".unityasset" package in to your project using the "Asset -> Import Package -> Custom Package" option from the Unity Editor menu.
What the MRTK provides though, is an optional one stop shop to prepare and configure your project automatically, to get you up and running even quicker.
This simply prompt will (as the message box suggests):
- Setup XR settings in your current platform (you will still have to enable it for your other deployment platforms)
- Apply Unity standard source control options
- Set your Scripting backend to IL2CPP (Which will be the default from 2018.3 as the .NET backend is being deprecated)
- Upgrade your project to use the .NET 4 scripting runtime (mandatory, which Unity forces a reload of the editor)
If Unity is deprecating .NET, why use .NET 4?
Unity are only deprecating the .NET backend which is used in their "Player" projects on Windows platform. Unity have stated for a while now that their only build platform will be IL2CPP going forward .NET 4 scripting however, allows projects to use more advanced coding techniques in their projects which are then compiled to IL2CPP on build. Which the MRTK uses
Accepting this dialog is completely optional and you can choose to set the above options manually later if you wish, we won't ask you again.
With one exception, the MRTK takes advantages of advanced features available with the .NET4 Scripting Runtime, so your project MUST be configured to use it, else all you will get is a bundle of wires and loads of console errors.
Now that the MRTK is in your project, you are ready to get up and running.
Activating the MRTK in your scene
So you have your VR project and the MRTK installed, what next?
Again, the team have made it super easy to enable your scene to utilize the MRTK with another single menu option:
Mixed Reality Toolkit -> Configure
This will automatically update your scene to be MRTK ready by adding the toolkit (a single object) and configuring your camera in the scene hierarchy as shown below:
This simply applies:
- Mixed Reality Toolkit - The toolkit itself, providing the central configuration entry point for the entire framework.
- MixedRealityPlayspace - The parent object for the headset, which ensures the headset / controllers and other required systems are managed correctly in the scene.
- The Main Camera is moved as a child to the Playspace - Which allows the playspace to manage the camera in conjunction with the SDK's
- UIRaycastCamera added as a child to the Main Camera - To enable seamless UI interactions through the toolkit
Note While working in your scene, DON'T move the Main Camera (or the playspace) from the scene origin (0,0,0). This is controlled by the MRTK and the active SDK. If you need to move the players start point, then move the scene content and NOT the camera!
The MRTK provides default configuration with every option turned on by default, which enables you to hit play as soon as your scene is configured. Whether you are on Windows Standalone with OpenVR or have switched to a Windows Store build (WSA), the project will just Run.
What is provided by default?
When you run your project using the default Mixed Reality Toolkit configuration, you get several features enabled without touching anything, namely:
- Headset tracking
- Controller tracking and visualization (represented as a 3D gizmo by default)
- Controller mappings for the default OpenVR/WMR controllers
- Gaze / Focus and Pointer interactions
- Rotation options (similar to the WMR portal experience, tapping left on the thumbstick rotates the view 90 degrees to the left)
- Teleportation controls and visualization (including orientation transportation)
Once you have played with the default, we recommend you create your own configuration and customize it to your project needs. We'll cover this in a later post (or you can play with the profile "Copy and customize" buttons)
Time to get started
The video also shows some quick instructions about getting your scene "VR Ready" by adding colliders and some quick interactivity, but that is best left to a fuller post on the subject.
You now have the tools you need to start exploring and crafting your very own Mixed Reality experience. have fun, get involved and if there is something you don't like (or even better that you really like) then let us know about it:
- Join us on the HoloDevelopers Slack channel to get help / advice or just to hang out
- Log issues on GitHub for the things you don't like or the things you want to see
- Check the site often for more news / details and upcoming features in the Beta