/ Published in: C#
Simple touch detection in unity for mob devices
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
using UnityEngine; using System.Collections; public class OnTouchDown : MonoBehaviour { foreach (Touch touch in Input.touches) { if (touch.phase == TouchPhase.Began) { // do staff when user just touch } else if (touch.phase == TouchPhase.Ended) { // do staff when user touch ended } } }