unity 触摸屏幕

if (Event.current.type == EventType.MouseDown) {

    //这里写鼠标按下(屏幕触摸按下)的代码

}

if (Event.current.type == EventType.MouseDrag) {
    //这里写鼠标拖动(屏幕触摸滑动)的代码

}

if (Event.current.type == EventType.MouseUp) {

    //这里写鼠标抬起(屏幕触摸抬起)的代码

}

Pos = Event.current.mousePosition;    //获取当前光标位置,其中横坐标和纵坐标分别是Pos.x和Pos.y,原点在左上角,单位为1像素
--------------------- 
作者:四月的小白 
来源:CSDN 
原文:https://blog.csdn.net/LittleWhiteLv/article/details/83000119?utm_source=copy 
版权声明:本文为博主原创文章,转载请附上博文链接!

猜你喜欢

转载自blog.csdn.net/LittleWhiteLv/article/details/83042616
今日推荐