void Update()
{
  if (Input.touchCount > 0)//手指数量
  {
    if(Input.GetTouch(0).phase == TouchPhase.Began && Input.GetTouch(0).tapCount == 2)//Input.GetTouch(0)表示手势
    {
    Debug.Log("Gesture DoubleClick");
    }
  }
 }

//以下是几种触摸方式:

namespace UnityEngine
{
  //
  // 摘要:
  // ///
  // Describes phase of a finger touch.
  // ///
  public enum TouchPhase
  {
    //
    // 摘要:
    // ///
    // A finger touched the screen.一根手指触摸屏幕。
    // ///
    Began = 0,
    //
    // 摘要:
    // ///
    // A finger moved on the screen.一根手指在屏幕上移动。
    // ///
    Moved = 1,
    //
    // 摘要:
    // ///
    // A finger is touching the screen but hasn't moved.手指在触摸屏幕,但没有移动。
    // ///
    Stationary = 2,
    //
    // 摘要:
    // ///
    // A finger was lifted from the screen. This is the final phase of a touch.一根手指从屏幕上抬了出来。这是触摸的最后阶段。
    // ///
    Ended = 3,
    //
    // 摘要:
    // ///
    // The system cancelled tracking for the touch.系统取消了对触摸的跟踪。
    // ///
    Canceled = 4
  }
}

05-11 15:25
查看更多