The Mixed Reality Forums here are no longer being used or maintained.
There are a few other places we would like to direct you to for support, both from Microsoft and from the community.
The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.
For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.
If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.
And always feel free to hit us up on Twitter @MxdRealityDev.
Type `UnityEngine.VR.WSA.Input.GestureRecognizer' does not contain a definition for `HoldEvent'
I'm trying to implement a hold gesture in my application according to this document https://developer.microsoft.com/en-us/windows/holographic/gestures_in_unity yet when I attempt to attach a listener via:gestureRecognizer.HoldEvent += GestureRecognizer_HoldEvent;
I get the error:Type 'UnityEngine.VR.WSA.Input.GestureRecognizer' does not contain a definition for 'HoldEvent'
Intellisense isn't working in Visual Studio and there is no documentation for the GestureRecognizer class making this impossible to debug. Does anyone know if that property has been renamed?
Best Answer
-
OptionsHoloSheep mod
@abarsotti the page in the docs that you link to might be in need of an update.
I did a quick check in a basic project I have here that is based on the latest Unity HTP and intellisense (which works in my environment) is showing the following three events related to the hold gesture:
gestureRecognizer.HoldStartedEvent += GestureRecognizer_HoldStartedEvent; gestureRecognizer.HoldCompletedEvent += GestureRecognizer_HoldCompletedEvent; gestureRecognizer.HoldCanceledEvent += GestureRecognizer_HoldCanceledEvent;
All three generated handler stubs show the same args:
private void GestureRecognizer_HoldCanceledEvent(InteractionSourceKind source, Ray headRay) { throw new System.NotImplementedException(); } private void GestureRecognizer_HoldCompletedEvent(InteractionSourceKind source, Ray headRay) { throw new System.NotImplementedException(); } private void GestureRecognizer_HoldStartedEvent(InteractionSourceKind source, Ray headRay) { throw new System.NotImplementedException(); }
HTH
Windows Holographic User Group Redmond
WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
WinHUGR YouTube Channel -- live streamed meetings5
Answers
@abarsotti the page in the docs that you link to might be in need of an update.
I did a quick check in a basic project I have here that is based on the latest Unity HTP and intellisense (which works in my environment) is showing the following three events related to the hold gesture:
All three generated handler stubs show the same args:
HTH
Windows Holographic User Group Redmond
WinHUGR.org - - - - - - - - - - - - - - - - - - @WinHUGR
WinHUGR YouTube Channel -- live streamed meetings
After implementing these events I still can't get them to trigger. I have a simple script based off of the TapToPlaceParent script in the Hololens 101 tutorial:
` using UnityEngine;
using System.Collections;
And I have that attached to a game object where a tap event is currently being used and triggering correctly. I've modified the HoloToolkit's GestureManager script to include the HoldStarted and HoldCompleted Events as follows:
gestureRecognizer.HoldStartedEvent += GestureRecognizer_HoldStartedEvent; gestureRecognizer.HoldCompletedEvent += GestureRecognizer_HoldCompletedEvent;
in the Start method,
` private void OnHoldStart()
{
if (focusedObject != null)
{
focusedObject.SendMessage("OnHoldStart");
}
}
implemented within the class, and then I'm deregistering the events in OnDestroy.