This a strange bug where GUI window of mine gets drawn behind other elements of gui.
PS: all the elements are drawn from same file and irrespective of the GL contents, it still gets drawn behind the other elements. especially begin groups / boxes. Tried everything from changing drawing order.
it is a bit more complicated actually and the logic resides across various files but gets called from a single OnGUI function... and only of of it is window which you see at the bottom of the graph.
without the code i can unfortunaly not really help but i think it may help if i tell you that the gui elements are drawn in the order you type the code
for example
draw gui A;
draw gui B;
itll first draw gui A and then gui B on top of it
I know that very well i am calling the gui window at the end of all calls
It is some bug with unity or the way GUI windows work! i dont know but the problem was with events of unity3d, When GUI Layout is getting called, the GUI window is supposed to be drawn, otherwise the window wont be displayed. And also repaint for the window gets calls as soon as first call to GUI.Window is being made that is the layouting event, so the window gets drawn first and then the other objects repaint event, hence the window goes behind everything.
this doesnt happen when I tried to call the whole gui from same script! But happens when i have the gui components across different scripts and try to call all of them from a single ongui.
And i solved it by using this
if(e.type == EventType.layout)
return;
for other components and by calling GUI window as the last call.
Still not clear on why this happens but will mark this as answer until i get an exact one!
Could you show us the code you use for 3 windows that overlap themselves, and tell us what code corresponds to which window ?
– KiraSenseiit is a bit more complicated actually and the logic resides across various files but gets called from a single OnGUI function... and only of of it is window which you see at the bottom of the graph.
– flamyassume that each component u see in the window comes from a different file but the manager calls all these files from its ongui
– flamy