Unity 3D——Touch的用法

   if (Input.touchCount >= 1)
       {
           Touch touch = Input.GetTouch(0);
            switch (touch.phase)
            {
                case TouchPhase.Began:
                     previousTouchPosition = touch.position;
                     isMoving = false;
                     break;

                 case TouchPhase.Moved:
                     isMoving = true;
                     deltaMove = touch.position - previousTouchPosition;
                     previousTouchPosition = touch.position;
                     break;

                 case TouchPhase.Ended:
                     if (!isMoving)
                      {
                      }
                      isMoving = false;
                     break;
              }
        }

你可能感兴趣的:(Unity,3D)