- Home /
How to pass a click through a button?
Greetings, if button B is placed behind button A how to click them all at once? By default A button uses a click but blocks it for B button.
sorry I don't know much about button handling, but does it use a raycast?
Answer by Fissll · Dec 31, 2015 at 09:46 AM
Hi, I don't know if this is the best way but it works for me. You just have to add a new OnClick Event in the inspector at the most top button and then you drag and drop the button which is covered by the current button into the event and select Button.select You can of course add as many buttons to the events list as you want.
Alas, this approach is quite dirty and not flexible at all. It works well for several objects, but i just cannot add event handlers for all bottom objects for each button. I just want object to receive all input events but not block objects that are behind it.
Ratcast---------->A(is clicked)--------->B(is clicked)
Right now it's either
Ratcast------------A(is not clicked)--->B(is clicked)
or
Ratcast---------->A(is clicked)----------B(is not clicked)
Well then you would have to change how Unity2D works I guess or you would have to create your own buttons