how to send clickEvent to GUI.Button


I’m tring to walk around how to use GUI.Button with touch on Windows, and one solution can be put a transparent object at same position and scale of GUI.Button at screen and do raycastHit to know if you are tring to push GUI.Button.

Anyone knows how to emulate Click on GUI.Button?


GUI.Button should recognize touch on all mobile devices. If you’re testing on Windows Phone, try Unity 4.3.4 or 4.5.2. There were some bugs in 4.5.

If you’re using a touchscreen on Windows Desktop/Store, you’ll have to use Input.Touch(). When you draw your GUI.Button, save the button’s rect. (If you use GUILayout, use GUILayoutUtility.GetLastRect().) In Update(), check that rect against Input.Touch().

You know that if you do:


your button is created and checked if was clicked at the same time, right?
Sorry if wasn’t this that you are looking for, I didn’t understand well .