- Home /
Tapping on both sides of GUI.Button behaves like click
Hi,
I want to know if this behaviour is intended or is it a bug? I have created a GUI.button, and when I tap on the both sides of the button simultaneously (no matter how far), the click function is executed. I have tested it on various sizes and positions of buttons (on iPad and Android).
Answer by Bunny83 · Dec 31, 2013 at 03:09 PM
Yes, it is (kind of) intended. Unity emulates a mouse cursor at the arithmetic mean of all touch points.
You can install my MobileStats.apk on your android device to see where the GUI-mousePosition is.
I just updated the link to the apk. Note that this question was about he IMGUI mouse position (OnGUI callback). Also note that you need to allow Apps from unknown sources to install this apk. For those who are paranoid or do not trust my app, here's pretty much all code: App.cs & Drawing.cs. Note that the Drawing.cs doesn't work anymore since Unity dropped the support for dynamically creating shaders from a string. So you need to find a shader / material replacement. The app also allowed to drag around any objects in the scene with multi touch support.
Cashif Ilyas original comment which is lost:
Is there a way to disable it? Because it is creating problems for me..
my answer:
No, not for the default GUI controls. Each click requires tracking of which finger has pressed, moved, released on which control. Unity's event system only works with a single mouse. However you can create your own controls which uses the touch input directly ins$$anonymous$$d of the emulated mouse, but it's quite a bit of work. You need to handle all events yourself and you need your own "hotcontrol" concept for multiple buttons / touches.
Your answer
![](https://koobas.hobune.stream/wayback/20220613125229im_/https://answers.unity.com/themes/thub/images/avi.jpg)