- Home /
Weird bug: tapping on any GUI button leads to another 3D button handler execution
I faced a strange bug: I have some buttons described in OnGUI function. I also have a 3d gameobject button with 2d collider which populates an event when pressed. I subscribed a handler (HandleBackPressed function) on this event. Tapping on this 3D button works fine, but tapping on any other GUI button runs 3D button's handler function. This happens only on iOS devices, in web build and in editor everything works as expected. This can be fixed by tapping on a blank area of the screen. After that, tapping on GUI buttons works well. I tried to create another GUI buttons with no code inside and place them in different areas of the screen, but tapping on any of them reproduces the same bug - gameobject button's code is called. Can someone help me with this problem? Thank you.