首页 > 解决方案 > 在屏幕上滑动以在游戏中滑动

问题描述

我如何检测玩家何时向下滑动屏幕并让他滑动?我试图做这样的事情:

    if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)

        startTouchPosition = Input.GetTouch(0).position;

    if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Ended)
    {
        endTouchPosition = Input.GetTouch(0).position;

        if (endTouchPosition.y < startTouchPosition.y)
            preformSlide();
            Invoke("StopSlide", 1);
    }

标签: c#unity3d

解决方案


推荐阅读