Posted By

jquery404 on 09/04/12


Tagged

mobile android touch unity3d


Versions (?)

Simple Touch Input


 / Published in: C#
 

Simple touch detection in unity for mob devices

  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class OnTouchDown : MonoBehaviour {
  5.  
  6. foreach (Touch touch in Input.touches)
  7. {
  8. if (touch.phase == TouchPhase.Began)
  9. {
  10. // do staff when user just touch
  11. }
  12. else if (touch.phase == TouchPhase.Ended)
  13. {
  14. // do staff when user touch ended
  15. }
  16. }
  17.  
  18. }

Report this snippet  

You need to login to post a comment.