- Home /
Graphics Raycaster - Click on overlapped buttons
So I was playing with the new UI system and I tried one (I know, wierd) situation where two buttons are overlapped, and based on my previous Unity experience, I thought that both buttons would respond to the click (something similar with using the UI on a 3D environment).
Is there any way I can allow this situation? It could come out handy to me when using a tutorial overlay to highlight some buttons.
Yeah, I was checking GraphicsRaycaster source code and apparently it always gets the first hit ins$$anonymous$$d of all hits like the other Raycasters. It's a shame it can't be done natively in Unity. The temporary solution I found was executing an event ( ExecuteEvents.Execute) in the other button, which is working fine given the situation.
Answer by SamiSiddiqui · Apr 02, 2015 at 12:43 PM
Its not built into unity. You will have to propagate the click event to overlapped button. Which ofcourse you can do dynamically or used a fixed button as references. Based on how much you are using it.
If your buttons are in different canvas then you will have to disable Graphics Ray caster in one of the canvas to get the button your like to work.
Your answer
Follow this Question
Related Questions
Show Image when button is highlighted 1 Answer
Changing anchor positions on UI? 0 Answers
UI Buttons - affects all 0 Answers
UI Selection in GameObject dropdown out of place? 1 Answer
OnPointerEnter and OnPointerExit not being triggered 0 Answers