Mobile Gesture Double-click (Ongui can also respond on the mobile side, but the frame rate is too low)

Source: Internet
Author: User

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.