团结开始触摸不检测

时间:2018-06-24 04:59:18

标签: c# unity3d

我想检测何时有人触摸了屏幕。为此,我在更新功能中包含以下代码:

    print(Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began); //Prints false

    if(Input.touchCount > 0)
    {
        print(Input.GetTouch(0).phase); //Prints stationary
    }

    if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began)
    {
        currentTrail.transform.position = cam.ScreenToWorldPoint(Input.GetTouch(0).position);
        rb.position = cam.ScreenToWorldPoint(Input.GetTouch(0).position);
        print("touched down"); //Doesnt get called
        circleCollider.enabled = false;
        currentTrail = Instantiate(trail, transform);
        isCutting = true;
    }

因此,您可以看到,如果未调用陈述,我的接触就开始了。

屏幕正在检测触摸,但是其阶段是固定的,从不开始就开始。

0 个答案:

没有答案
相关问题