- Home /
GUILayout.Buttons overlap but only can click the bottom one
So I have my layout where you have GUILayout.Buttons cascading down based on how many objects you have, and then I have GUILayout.Buttons at the bottom of my screen for general navigation. The problem I currently have is that even though the logic puts the buttons in the right place and they draw properly, I can only click the bottom buttons when they are behind the top buttons. Does anyone know why?
When using the inbuild GUI
module. Only one button can be clicked at any time.
Yeah, I get that. But why isn't it the button painted on top?
It's a known UnityGUI bug. See here for more information.
As far as I know, the 'best' workaround is to implement your own button drawing function, that respects a special 'lock' for when it is occluding other elements.
Ok, I figured there was something wrong in Unity, but couldn't find any reference. Thanks.
@m4a44 Because the order in which you test for button pressing is also the render order. Therefore the button first tested for, is rendered first and everything else is rendered on top.
@syclamoth It's not a bug, it's just part of the rendering pipeline. It can be changed by manually setting the depth.
Personally, i find that order useful :)
Your answer
Follow this Question
Related Questions
button drawn last not triggered 0 Answers
4.6 UI Check if a button and a in-game object are overlapping 0 Answers
MouseOver for multiple GUILayout.Buttons? 1 Answer
Finding position of button in guilayout grid 0 Answers
Another draw call question 1 Answer