title: How to run the airtap OnSelect Method exactly Once on Tap?
body: <p>I'm working on a YuGiOh HoloLens App with some others on github, and we are stuck on airtaps. I have done all of the functionality and tested it with the OnMouseDown() function Unity does. This function is called once when an object is clicked. The code in between doesn't really matter, but I wanted to show there shouldn't be anything funky going on.</p>
  
  <pre><code>void OnMouseDown()
  {
      Debug.Log(myGameManager);
      Debug.Log(myZone);
      myGameManager.setSelectedCard(this, myZone);
  }
  </code></pre>
  
  <p>Now I want to airtap instead of click and so we did the OnSelectMethod with this code:</p>
  
  <pre><code>void OnSelect()
  {
      Debug.Log(myGameManager);
      Debug.Log(myZone);
      myGameManager.setSelectedCard(this, myZone);
  }
  </code></pre>
  
  <p>and there is a GazeGestureManager which is attached to the object that registers the event. We pulled this code from Hololens Academy.</p>
  
  <pre><code>using UnityEngine;
  using UnityEngine.VR.WSA.Input;
  
  public class GazeGestureManager : MonoBehaviour
  {
  public static GazeGestureManager Instance { get; private set; }
  
  private Vector3 moveDirection = Vector3.zero;
  
  // Represents the hologram that is currently being gazed at.
  public GameObject FocusedObject { get; private set; }
  
  GestureRecognizer recognizer;
  
  // Use this for initialization
  void Start()
  {
      Instance = this;
  
      // Set up a GestureRecognizer to detect Select gestures.
      recognizer = new GestureRecognizer();
      recognizer.TappedEvent += (source, tapCount, ray) =&gt;
      {
          // Send an OnSelect message to the focused object and its ancestors.
          if (FocusedObject != null)
          {
              FocusedObject.SendMessageUpwards("OnSelect");
          }
      };
      recognizer.StartCapturingGestures();
  }
  
  // Update is called once per frame
  void Update()
  {
      // Figure out which hologram is focused this frame.
      GameObject oldFocusObject = FocusedObject;
  
      // Do a raycast into the world based on the user's
      // head position and orientation.
      var headPosition = Camera.main.transform.position;
      var gazeDirection = Camera.main.transform.forward;
  
      RaycastHit hitInfo;
      if (Physics.Raycast(headPosition, gazeDirection, out hitInfo))
      {
          // If the raycast hit a hologram, use that as the focused object.
          FocusedObject = hitInfo.collider.gameObject;
      }
      else
      {
          // If the raycast did not hit a hologram, clear the focused object.
          FocusedObject = null;
      }
  
      // If the focused object changed this frame,
      // start detecting fresh gestures again.
      if (FocusedObject != oldFocusObject)
      {
          recognizer.CancelGestures();
          recognizer.StartCapturingGestures();
      }
  }
  }
  </code></pre>
  
  <p>Now we have used this code several times and any which way we set it up the OnSelect() method is called anywhere from 4-36 times. Why is it not being called only once?</p>
  
  <p>Could it be that airtab is a continuous event?</p>
  
  <p>Which keeps getting polled while the tap is going on? and if so, is there a better suited event to use? (OnAirTapEnd?) or something along those lines?</p>