Advertisement
Guest User

Untitled

a guest
Apr 28th, 2015
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. if(Input.GetMouseButtonDown(0)) {
  2.  
  3. hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
  4.  
  5. if(hit) {
  6.  
  7. if(transform.name == hit.transform.gameObject.name) {
  8.  
  9. Debug.Log("Button touched");
  10. }
  11. }
  12. }else
  13. if(Input.GetMouseButtonUp(0)) {
  14.  
  15. //hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
  16.  
  17. if(hit) {
  18.  
  19. if(transform.name == hit.transform.gameObject.name) {
  20.  
  21. Debug.Log ("touched up over same button.");
  22. }else {
  23. Debug.Log ("touched up not over same button.");
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement