unity3d 触屏拖拽物体代码

public float speed = 0.1f; void Update() { if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Moved) { Vector2 touchDeltaPosition = Input.GetTouch(0).deltaPosition; transform.Translate(touchDeltaPosition.x * speed, touchDeltaPosition.y * speed, 0); } }


    推荐阅读