Clicking on uGUI button also trigers onMouseDown underneath it

I have a screen space button which is over some prefabs, which have script with onMouseDown function attached to them. If I click on button it triggers OnMouseDown on that prefab. You can see that I clicked on buttons and it also triggered OnMouseDown on those blocks, which made them red, everything was fine with legacy gui
.

Stop using OnMouse events :slight_smile:

Try implementing the IPointerClickHandler interface and using OnPointerClick instead of the OnMouseDown

See the second question in the FAQ.

1 Like