# differentiate gui depth

**URL:** https://discussions.unity.com/t/differentiate-gui-depth/530108
**Category:** UI
**Tags:** IMGUI
**Created:** [February 25, 2014, 4:37pm UTC](https://discussions.unity.com/t/differentiate-gui-depth/530108 "2014-02-25T16:37:40Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![lx904](https://avatars.discourse-cdn.com/v4/letter/l/51bf81/32.png) [@lx904](https://discussions.unity.com/u/lx904)
#### Post date: [February 25, 2014, 4:37pm UTC](https://discussions.unity.com/t/differentiate-gui-depth/530108/1 "2014-02-25T16:37:40Z")

</div>

I have two scripts,  
In script one, it draws a GUI.button and when I click on it. it invokes a function in script two, which draw file browser dialog using GUILayout.  
It does the drawings, the only problem is that the file browser is drawn behind the GUI.button.

I tried several way to set GUI.depth. But it seems don’t work.

Any solution will be appreciated!

---

<div class="post-metadata">

### Author: ![Patico](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/patico/32/554756_2.png) [@Patico](https://discussions.unity.com/u/Patico)
#### Post date: [February 27, 2014, 1:29pm UTC](https://discussions.unity.com/t/differentiate-gui-depth/530108/2 "2014-02-27T13:29:51Z")

</div>

GUI.depth sometimes works strange. I could suggest your to use GUI.Window() as workaround.
