1、开启多点触摸
//开启多点触摸
Input.multiTouchEnabled = true;
2、判断单点触摸
if(Input.touchCount == 1)
{
//触摸对象
Touch touch = Input.touches[0];
//触摸位置
Debug.Log(touch.position);
//触摸阶段
switch (touch.phase)
{
case TouchPhase.Began:
//开始
break;
case TouchPhase.Moved:
//移动
break;
case TouchPhase.Stationary:
//静止
break;
case TouchPhase.Ended:
//结束
break;
case TouchPhase.Canceled:
//取消
break;
}
}
3、判断多点触摸
if(Input.touchCount == 2)
{
Touch touch1 = Input.touches[0];
Touch touch2 = Input.touches[1];
}