I am using TouchScript (v9.0) with Unity (2018.2.14f1) and am struggling with getting the Flicked
gesture event to fire. I created an empty game object with a few UI elements in it (text and raw images) and added the Flick Gesture
component to it (didn't change any of the settings on it), along with a custom script I wrote to register the Flicked
event - this code is mostly from the wiki:
public class FlickGestureHandler : MonoBehaviour {
FlickGesture gesture;
// Use this for initialization
void Start () {
gesture = GetComponent<FlickGesture>();
if (gesture != null)
{
gesture.Flicked += flickedHandler;
}
else
{
print("Gesture is null...");
}
}
public void flickedHandler(object sender, EventArgs e)
{
print("Flick gesture recorded");
}
}
I've also added an empty and added a Touch Manager
component to it, although I don't know if that does anything by itself, or how to connect it to my draggable game object.
When I run the app, I wait for the gameobject's contents to appear (I am using Keyframe animation and the UI elements do not appear until a few seconds after load), then try to drag the UI elements in any direction and nothing is printed to the console. I am using a touch screen monitor and a touch pen for this. Why is the event not firing? FWIW, I tried creating a simpler example where I just attach the scripts (Flick Gesture
and my custom script Flick Gesture Handler
) to an image object and I got the same result.