首页 > 解决方案 > 游戏有时无法识别触摸

问题描述

我使用 unity 制作了一个游戏,并在 google play store 上发布了它。但是,它有一些问题。当我开始游戏一段时间后,它无法识别我的触球。我不知道为什么。这是使玩家移动的更新功能:

   public void Update(){
      
        Vector2 vel=rb.velocity;
        float ang = Mathf.Atan2(vel.y,10)*Mathf.Rad2Deg;
        transform.rotation = Quaternion.Euler(new Vector3(0,0,ang));
        if (Input.GetMouseButton(0))
        {
            rb.AddForce(Vector2.up * gravity * Time.deltaTime * 1500f);
        }

    }

我应该使用触摸而不是 Input.GetMouseButton(0) 还是还有其他问题? 如果你想检查,这是我的游戏

编辑:它可以识别但需要太多时间

标签: c#unity3d

解决方案


推荐阅读