Activating and Deactivating Objects in Unity using HoloToolkit InputManager

Over the weekend, I helped Microsoft as a mentor at HoloHack in Atlanta. While there, it was great watching folks who had never tried to work with the HoloLens before.

This week I received a question from one the members from Learn HoloLens. The issue was hiding an object by air tapping on it utilizing the HoloToolkit.

I created a video to answer the question and you can check it out here:

HideMe.cs

using HoloToolkit.Unity.InputModule;
using UnityEngine;

public class HideMe : MonoBehaviour, IInputClickHandler
{
     public void OnInputClicked(InputClickedEventData eventData)
     {
         gameObject.SetActive(false);
     }
}

ShowAll.cs

using HoloToolkit.Unity.InputModule;
using System.Collections.Generic;
using UnityEngine;

public class ShowAll : MonoBehaviour, IInputHandler
{
     public List<GameObject> GameObects;

    private void Start()
     {
     }

    public void OnInputDown(InputEventData eventData)
     {
     }

    public void OnInputUp(InputEventData eventData)
     {
         foreach(GameObject go in GameObects)
         {
             go.gameObject.SetActive(true);
         }
     }
}

One thought on “Activating and Deactivating Objects in Unity using HoloToolkit InputManager

Tell me what you think!