2016-07-05 94 views
1

Input.GetTouch(0).phase == TouchPhase.BeganInput.GetMouseButtonDown (0)Input.GetMouseButton(0)等效於觸摸嗎?

Input.GetTouch(0).phase == TouchPhase.Ended相當於是Input.GetMouseButtonUp (0)

什麼是Input.GetMouseButton (0)等效等價?

+1

可能有助於http://stackoverflow.com/questions/36048106/horrors-of-onpointerdown-versus-onbegindrag-in-unity3d – Fattie

+0

@Dake。很好,你正在學習如何使用Input.GetTouch。傑裏的回答實際上就是你要找的。如果你想在屏幕上檢測一下,使用'Input.touchCount == 1'。要在屏幕上檢測多個觸摸,請使用'Input.touchCount> 0'。答案應該被接受。 – Programmer

回答

2
Input.touchCount > 0 

但仍然取決於你真正想要的。也許是更好地爲您:

Input.touchCount == 1