Is there a way to control the order in which GUI is drawn?
Say i have two game objects A and B who draws their own gui GA and GB using the OnGUI method. Now i want to make sure that GA is always drawn ontop of GB is there a way to control this?
function OnGUI ()
{
// This will be drawn below
GUI.depth = 2;
GUI.Box (Rect (), "Box");
// This will be drawn on top
GUI.depth = 4;
GUI.Box (Rect (), "Box2");
}
Actually, that won’t quite work when you throw input into the mix.
Then you either need to use Window (if you want click-to-bring-to-front behaviour), or put your two pieces of GUI into seperate scripts, then set the depth of each script.