OnGUI draw order issue

I have an editor window that draws a dynamic tree hierarchy, where each node is a GUI.Box, after that in the code I draw the connecting accordion lines. As you can see the lines are drawn in front of the tiles.
This is happening in a single script.
I moved the drawing of the tiles after the drawing of the lines, but it didnt work.
I tried GUI.depth, didnt work.

Edit:
What Im doing in code is:

foreach(allTiles) {
	if(something) {
		drawConnectinglines()
	}
	drawTileAndItsContent
}

Now Itried seperating the tile draw and line draw in different loops:

   foreach(allTiles) {
    	if(something) {
    		drawConnectinglines()
    	}
    }
    foreach(allTiles) {
    	drawTileAndItsContent
    }

The result is that now the lines are behind the buttons in the tiles, but infront of them:
62585-2016-01-25-16-19-00-unity-mainunity-gar-fuze-gar-f.png

First of all : we need more information then that to help you.
Second : changing the order should have done the trick but i can’t tell why it didn’t (not enough informations)
Finally : i think you should draw every child of each branch before going to the next like this :

Root
  |
  +----A
  |     |
  |     + ------A1
  |     |          |
  |     |          +-----A1a
  |     |          |
  |     |          +-----A1b
  |     |          |
  |     |          +-----A1c
  |     |
  |     +-------A2
  |     |          |
  |     |          +-----A2a
  |     |
  |     +-------A3
  |
  +----B
         |
         + ------B1
                     |
                     +-----B1a
                     |
                     +-----B1b

Like this you shouldn’t have anything overlapping. And you can use recusivity to display that tree.

Hope it helps you, but if you want more you’ll have to give us more to work with.