# Windows always behind GUI elements

**URL:** https://discussions.unity.com/t/windows-always-behind-gui-elements/421210
**Category:** UI
**Tags:** IMGUI
**Created:** [August 23, 2010, 2:00am UTC](https://discussions.unity.com/t/windows-always-behind-gui-elements/421210 "2010-08-23T02:00:47Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![matrix211v11](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/matrix211v11/32/882755_2.png) [@matrix211v11](https://discussions.unity.com/u/matrix211v11)
#### Post date: [August 23, 2010, 2:00am UTC](https://discussions.unity.com/t/windows-always-behind-gui-elements/421210/1 "2010-08-23T02:00:47Z")

</div>

Hello All!

According to the docs, GUI.Window is supposed to be over all the normal GUI elements, such as GUI.Box or GUI.DrawTexture.

For whatever reason, my GUI.Window are always behind my GUI elements. I am not using any GUI.depth or anything crazy like that.

Is there something I can check? This is causing me all sorts of grief trying to make floating windows that are always behind the normal elements.

Thanks!

---

<div class="post-metadata">

### Author: ![Dreamora](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/dreamora/32/91058_2.png) [@Dreamora](https://discussions.unity.com/u/Dreamora)
#### Post date: [August 23, 2010, 2:10am UTC](https://discussions.unity.com/t/windows-always-behind-gui-elements/421210/2 "2010-08-23T02:10:35Z")

</div>

if they arent in the same ongui, they will have depth layer controlled through gui.depth

the “is always” stuff only applies within the same ongui

---

<div class="post-metadata">

### Author: ![anon\_3804373](https://avatars.discourse-cdn.com/v4/letter/a/87869e/32.png) [@anon\_3804373](https://discussions.unity.com/u/anon_3804373)
#### Post date: [August 23, 2010, 7:08am UTC](https://discussions.unity.com/t/windows-always-behind-gui-elements/421210/3 "2010-08-23T07:08:06Z")

</div>

can you put a screenshot how your windows behind gui elements look like?

---

<div class="post-metadata">

### Author: ![matrix211v11](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/matrix211v11/32/882755_2.png) [@matrix211v11](https://discussions.unity.com/u/matrix211v11)
#### Post date: [August 24, 2010, 7:13am UTC](https://discussions.unity.com/t/windows-always-behind-gui-elements/421210/4 "2010-08-24T07:13:54Z")

</div>

Can you have multiple GUI.depth in the same OnGUI?

---

<div class="post-metadata">

### Author: ![andeeeee](https://avatars.discourse-cdn.com/v4/letter/a/51bf81/32.png) [@andeeeee](https://discussions.unity.com/u/andeeeee)
#### Post date: [August 25, 2010, 10:52am UTC](https://discussions.unity.com/t/windows-always-behind-gui-elements/421210/5 "2010-08-25T10:52:36Z")

</div>

GUI.depth applies to the whole script - you should only set it once. You can, however, have several scripts with different depths attached to the same GameObject.

---

<div class="post-metadata">

### Author: ![Dreamora](https://dub1.discourse-cdn.com/unity/user_avatar/discussions.unity.com/dreamora/32/91058_2.png) [@Dreamora](https://discussions.unity.com/u/Dreamora)
#### Post date: [August 25, 2010, 11:18am UTC](https://discussions.unity.com/t/windows-always-behind-gui-elements/421210/6 "2010-08-25T11:18:33Z")

</div>

> [@""](#):
>
> Can you have multiple GUI.depth in the same OnGUI?

GUI.depths only handles the depth between scripts

within the same script, the order of commands defines their “depth order”.  
whats drawn last is on top, whats drawn first, is furthest in the back
