Unity 5.5 and the HoloToolkit – Changes in Input when Developing HoloLens Apps

Blog Posts ,HoloLens ,Programming ,Unity
December 7, 2016

Last week, with the release of Unity 5.5, new features around developing for HoloLens were added. The last HoloLens project that I worked on and released last month used the 5.4 HoloLens Technical Preview build of Unity, and an older version of the HoloToolKit, so when I sat down yesterday to start a new project, I was surprised to see that the input system for HoloLens development had changed somewhat substantially. I found the documentation a bit hard to wade through, so I wanted to share what I learned moving from the older development environment for HoloLens to the latest and greatest.

In earlier builds of the Holographic Toolkit (which you can get on GitHub here), there were three main scripts that managed the basis of interactivity within a scene: you had the Gaze Manager, the Gesture Manager, and several other components that would support voice input. To set up a basic gaze+gesture interaction, holograms would need to implement an “OnSelect()” function, which would receive messages sent from the gaze and gesture managers.

The latest version of the Holotoolkit (I built it from source yesterday, so 12/6) changes the input system quite a bit, making it more extensible and easy to work with, but I couldn’t find a lot of resources showing the differences. HoloLens apps built in Unity now use a global input manager, and different holograms can extend specific interfaces based on what input they need to support.

Before, to add in support for an air tap, a script on a game object might look like this:

using UnityEngine;
using System.Collections;
public class MyScript : MonoBehaviour {
    void Start(){
    void Update(){ 
    public void OnSelect(){
      // Some code here that is called when the air tap happens

Now, with the new input system, the script to add in an air tap event to a hologram looks more like this:

using HoloToolkit.Unity.InputModule;
using UnityEngine;

public class MyScript: MonoBehaviour, IInputClickHandler {
    public void OnInputClicked(InputEventData eventData)
        Debug.Log("I've been clicked");

    // Use this for initialization
    void Start () {
    // Update is called once per frame
    void Update () {

Note the following differences in handling input that the holograms have on their behavior scripts:

  • Importing in the HoloToolkit.Unity.InputModule class.
  • Extending the IInputClickHandler interface in addition to the base MonoBehaviour
  • Changing from “OnSelect” to “OnInputClicked”

Additionally, the HoloToolkit now has some new prefabs that help with setting up your scene to utilize the new input system: a HoloLens Camera prefab contains a manual gaze control script for use in the editor, and the InputManager prefab processes input more generally so that you don’t need to write your own manager object with each of the independent control scripts. The InputManager prefab also enhances the overall cursor experience in the editor.

I have yet to experiment with some of the newer features in the input system to really put it through its paces, but stay tuned: I’m working on a new project with the updated toolkit that I’m excited to document over the next couple of weeks!

Related Posts

1 thought on “Unity 5.5 and the HoloToolkit – Changes in Input when Developing HoloLens Apps”

  1. Rik Basu says:

    Thanks for this! I confused as to why they were handling input in different ways, but didn’t realize there was an update.

Leave a Reply