using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SceneManagement;
public class SceneTest : MonoBehaviour
{
AsyncOperation operation;
void Start()
{
//开启多点触摸
Input.multiTouchEnabled = true;
}
void Update()
{
//判断单点触摸
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;
default:
break;
}
}
//判断多点触摸
if (Input.touchCount==2)//两个点
{
Touch touch1= Input.touches[0];
Touch touch2 = Input.touches[1];
}
}
}
Unity中如何写手机触屏功能
最新推荐文章于 2023-09-15 16:45:03 发布