10
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Unityメモ 同時タッチ数ごとに処理を分ける [Android]

Posted at
TouchManager.cs
public class TouchManager : MonoBehaviour {

    // タッチ
    Touch touch;


	void Update () 
    {
	    if (Input.touchCount > 0) 
        {
            this.touch = Input.touches[0];

            if (this.touch.phase == TouchPhase.Began)
            {
                Debug.Log("Input.touchCount == " + Input.touchCount);
                switch (Input.touchCount)
                {
                    case 1 : // 1本指でタッチ
                        Debug.Log("Single Touch");
                        break;

                    case 2 : // 2本指でタッチ
                        Debug.Log("Double Touch");
                        break;
           
           case 3 : // 3本指でタッチ
                        Debug.Log("Triple Touch");
                        break;
                }
            }
        }
    }
}
10
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?