Advertisement
LittleAngel

GUITextureButton

Mar 12th, 2012
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. [RequireComponent (typeof (GUITexture))]
  5.  
  6. public class TouchButton : MonoBehaviour {
  7. public GUITexture theButton;
  8.  
  9. void Update () {
  10. if (Input.touchCount > 0) {
  11. foreach (Touch touch in Input.touches) {
  12. if (theButton.HitTest(touch.position)) {
  13. DoSomething();
  14. }
  15. }
  16. }
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement