Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if(Input.GetMouseButtonDown(0)) {
- hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
- if(hit) {
- if(transform.name == hit.transform.gameObject.name) {
- Debug.Log("Button touched");
- }
- }
- }else
- if(Input.GetMouseButtonUp(0)) {
- //hit = Physics2D.Raycast(Camera.main.ScreenToWorldPoint(Input.mousePosition), Vector2.zero);
- if(hit) {
- if(transform.name == hit.transform.gameObject.name) {
- Debug.Log ("touched up over same button.");
- }else {
- Debug.Log ("touched up not over same button.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement