Developing my first HoloLens app

Wow. Unity is awesome. No. Unity is freaking awesome.

Seriously. As someone who has had to write her own physics engine three times (1. Space Invaders – my senior project in college, 2. Kinect app – my masters project, and 3. WebTop – Laser and Reflection and Refraction modules – my first developer job in college), I wish I had taken the time to learn Unity sooner.

To learn Unity (shameless plug alert: github is working on a plugin for Unity), I was curious what the experience would be like if I took the most-starred open source repositories graph from https://octoverse.github.com/ and made it into a holographic app.

most-starred open source repositories graph

Here’s what my first take of the above octoverse graph as a holographic app.

and here’s the holo-octoverse repo.

Here’s my suggested order of training (as of this writing on Feb 24, 2017)

  1. Get comfortable in unity before you do anything – https://unity3d.com/learn/tutorials/projects/roll-ball-tutorial TBH, I’d pay for a course that does nothing but teach me how to navigate around a scene in the unity scene. I got motion sickness on several occasions trying to navigate around the scene. True story.
  2. Start with the hololens 100-level trainings offered at the Microsoft HoloLens Academy – https://developer.microsoft.com/en-us/windows/holographic/academy
  3. Get comfortable using the Emulator. The sooner you realize that the dot on the screen is NOT the gaze cursor, the more hours you’ll get back on your life.
  4. Take the pluralsight HoloLens course – it’s similar to the hololens 100 level courses, but with a bit of a different twist, so you’ll learn new things and help retain the info you just learned from the 100 levels.
  5. (Optional) – at this point I knew enough to build my app, so I didn’t continue with the 210 levels, except to grab bits and pieces of things I needed.

Hidden gotchas

  • My absolute biggest struggle was deciding when should a script apply to the entire node collection (i.e. the parent GameObject of all my nodes) or to an individual node. I was going around in circles (no pun intended, as this is a 3D connected graph). Finally, I started splitting scripts out individually (who knows if that is correct) and also I’d rather do more manual work in unity (i.e. wiring up public GameObjects to a script) rather than trying to figure out how to do all that at runtime. I’m confident there’s a better way, but it is a start…
  • Renaming a script in unity – renaming the script in unity will rename the filename (and will update the components using that script for you), but you’ll need to rename the class in Visual Studio (remember, ctrl+dot is your friend). A few times I had to restart unity because of errors.
  • Clearing warnings and errors:
    • If you have any compile errors, you’ll won’t know in Visual Studio. You’ll find out in Unity, at the bottom in the status bar where you won’t know to look at the beginning. You’ll double-click the status bar to see more about the error.
    • Once you think you’ve fixed your error, you’ll need to clear this output window. Otherwise, next time you update your script from VS and switch back into Unity, you’ll might be confused why your error still persists.
  • Always hit the play button in unity to verify there are no script errors. You can catch some null pointer exceptions this way.
  • Using the emulator
    • Sometimes your holograms will appear besides you, or behind you. Or your holograms appear in the bathroom, making people really confused by your tweets.
    • The emulator should come with a “I Accept” button that says the little dot is NOT the gaze for the tap gesture. (Have I mentioned lost hours). I lost a lot of time debugging why my tap recognizer wasn’t firing because I had the wrong cursor over the object.
    • You don’t have to close the emulator each time
    • If you’re just making an update in Visual Studio (e.g. in the multiple project solution), you can just redeploy to the emulator or hololens. You don’t have to rebuild in Unity.
  • For Visual Studio I keep the single-project solution opened to edit my scripts, but I close the solution produced by the unity build every time I’m done with that debugging session. YMMV
  • And honestly, the emulator is great. I used the actual device for sizing, e.g. how large should my object be? How far apart should they be spaced? But take note. if you’re goal is to use in a large space, you’ll need to test in that large space, versus doing your development in a small room.
  • For clipping planes, Microsoft recommends no nearer than 0.5m. Maybe it’s because I’m 5’1 and have practically no arm distance reach (I did karate for 20 years, trust me on this), but I found the near setting that worked best for me was at 0.35. But then again, perhaps holograms need to be placed farther away.
  • Where you develop your app versus where you film your app matters, as I mentioned previously. I was developing my app in a small room, so I had to have the nodes close to me; otherwise, they’d appear within the sofa. However, when you run the app in a large room, it makes you wonder why you didn’t space out the graph more.
  • When you go for a final build, make sure you choose Master instead of Debug or Release in VS. You also will want to delete the previous Release or Debug app on the device before you deploy your Master build.

Miscellaneous Helpful Links

  1. How to change the color of the cube we’re looking at?
    • See the Pluralsight training mentioned above.
  2. How to plot the x,y,z points on a Sphere – aka “how has my Math degree failed me today?”
  3. How to send the gesture command? At first I thought each object could register, but doesn’t seem to be the case
  4. How to use the Tapped event to generate new objects – at first I thought I’d be creating objects at runtime to display the Text overall, but decided not to go this route after all in the spirit of “get something working that you can demo”
  5. How to display 3D text
  6. How to have the text face you when you walk around
  7. How to find a child object

Leave a comment