void Update ()
{
if (Input.touchcount > 0)//number of fingers
{
if (Input.gettouch (0). Phase = = Touchphase.began && input.gettouch (0). Tapcount = 2)//input.gettouch (0) gesture
{
Debug.Log ("Gesture DoubleClick");
}
}
}
Here are a few touch modes:
Namespace Unityengine
{
//
Summary:
// ///
Describes phase of a finger touch.
// ///
public enum Touchphase
{
//
Summary:
// ///
A finger touched the screen. A finger touches the display.
// ///
began = 0,
//
Summary:
// ///
A finger moved on the screen. A finger moves on the display.
// ///
Moved = 1,
//
Summary:
// ///
A finger is touching the screens but hasn ' t moved. The finger is touching the screen without moving.
// ///
Stationary = 2,
//
Summary:
// ///
A finger is lifted from the screen. This is the final phase of a touch. A finger lifted out of the screen. This is the last stage of touch.
// ///
Ended = 3,
//
Summary:
// ///
The system cancelled tracking for the touch. The tracking of the touches is canceled.
// ///
Canceled = 4
}
}
Mobile Gesture Double-click (Ongui can also respond on the mobile side, but the frame rate is too low)