HoloLens Development: First Steps

Abstract

As you might've found out from other posts in my blog, I've spent quite a lot of time developing a Microsoft HoloLens application during my 2nd year in UCL. In this post I'd like to outline several things that beginner HoloLens developers might find useful. If you have the time, I suggest you read the whole thing as it might save you some trouble in the future.

Disclaimer: I've first begun working with HoloLens in the end of 2016, so information here might be slightly outdated.

1. Microsoft's Mixed Reality Academy

Mixed Reality Academy should be the first step of your journey into the world of HoloLens development. It will give you a basic understanding of the features that HoloLens offers to you and your users, as well as some common implementation strategies. Unfortunately, the tutorials don't really go over the code and it's more about you understanding how to setup a HoloLens project in Unity and Visual Studio, how to build your project, how to deploy it to HoloLens or emulator and so on. The second half is copying and pasting various snippets of code that have been written for you and seeing the whole HoloLens development pipeline in action.

I'd recommend glancing over the code in the tutorials and trying to understand what are the basic mechanisms and libraries involved in making certain things happen - like how information about user's hand movements can be used in Holograms 211 or how Gaze can be used to interact with objects in Holograms 210.

Make sure to not spend too much time learning different parts of code in tutorials by heart because some parts might be outdated and in fact specifics of implementation could have completely changed since the time tutorials where recorded. More about it in the next section.

2. Unity-HoloToolkit

Definitely read more about Unity-HoloToolkit on its GitHub page and browse the code and examples in the repo if you have the time. If you've done the tutorials, you would've encountered the HoloToolkit in some shape or form. Unity-HoloToolkit is pretty much the same thing but optimised to play nicely with Unity game engine. Keep in mind that the version used in the tutorials is most likely outdated, so I suggest cloning the repository linked in the beginning of this paragraph directly. As mentioned before, scripts and their interfaces might differ from the ones used in the tutorials, so copying and pasting the code from tutorials into a Unity project with the most recent version of Unity-HoloToolkit is probably not the best idea.

It's a collection of useful scripts that cover pretty much all of the basic needs of a HoloLens app developer, such as billboard/tagalong components, spatial understanding, hologram sharing and more. I wasn't able to find too much documentation about it so for me using it was pretty much a trial-and-error process, but you might have more luck than me.

A colleague and a good friend of mine, Fraser Savage, wrote this short overview of setting up a Unity project for HoloLens development. The section you're interested in is 1. Initial set up of the unity project, the rest might be a bit too specific to apply to you. Again, info there can be outdated but it should provide some basic guidance.

3. Unity and Visual Studio

One of the most important things to remember is that the HoloLens app you're developing in Unity is first and foremost a Unity app. Most of the challenges you'll be experiencing during the development process are common Unity issues, so make sure to scavenge Unity forums for solutions before blaming HoloLens developers. Don't get me wrong - I'm not saying that working with the HoloLens-specific part of the project will be easy, but from my experience 90% of the work will mostly focus on pure Unity development with little to none HoloLens aspects to it.

Choosing the right Unity version for the job is a a completely different story. First of all, if you're working in a group, you should all use the same version of Unity, or you'll have to spend ages re-importing and re-configuring your projects, given they will load at all. Also, do not update to the most recent version of Unity unless it has a feature crucial for your development process or you know what you're doing. It can break your app, it will mean all developers in your team will have to update, and, worst case scenario, HoloLens development might not even be supported on that new version so you'll have to go back to using an older version.

And that's not even the whole story. I'm not sure if the situation has changed since the last time I actively worked on a HoloLens project (I sure hope it has - I have an internship involving HoloLens in a month's time), but I had some issues understanding which Unity version I was actually supposed to use. This, combined with limited support for Visual Studio 2017 by the HoloLens emulator left me with a Unity project that would crash whenever I'd try to test it (funnily enough, only happened on my machine), and the only suggested solution was reinstalling my operating system, which is definitely not happening. What didn't help was that Unity-HoloToolkit GitHub readme files mentions the Required Unity Editor Version which breaks everything else. So take great care when choosing which Unity version to install and make sure you read everything Microsoft has to say about it.

To some extent, what I said above applies to Visual Studio too. To make your life easier you might want to install ReSharper, an amazing extension for Visual Studio that gives it some super powers of Intellij Idea. As a student, you can get a free license for a year and extend in the future, if needed.

4. General tips and tricks

I strongly suggest you read Performance recommendations for Unity by Microsoft before you start working on your project. It has some very useful tips on the architecture of your application which are quite hard to implement retrospectively.

To save yourself some time developing the UI for your app, you can use the existing UnityUI framework. To make it work with HoloLens, you'll have to make some adjustments, which can be found in this post on Unity forums.

If you found this post useful, feel free to like and share:

Comments