Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by kilgore · Jun 07, 2010 at 12:18 PM · guidepth

GUI.depth factors

Are there any other factors that control the depth of GUI elements? I currently have a few GUI.Windows in my scene, and one window is always showing above other windows even though its depth is far below the others.

I have the same setup in other scenes, with the same exact GUI.depth settings and its working fine.

I would like to note that group of windows that are being drawn over are all grouped together in the same script. The window drawing over said group is in a separate script.

Thanks

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image spinaljack · Jun 07, 2010 at 12:21 PM 0
Share

did you try writing the GUI code at the start? They tend to be drawn in the order that they are scripted

avatar image kilgore · Jun 07, 2010 at 02:04 PM 0
Share

The window element that is being drawn above the other elements is in another script altogether. GUI.depth is there so that you can have gui elements in the same scene at the same time but at different depths and in turn you then do not have to worry about order of render.

avatar image spinaljack · Jun 07, 2010 at 06:49 PM 0
Share

every OnGUI call (even if it's empty) has an overhead so it makes sense to have all your GUI scripts in one place

avatar image kilgore · Jun 07, 2010 at 11:41 PM 0
Share

OnGUI can be expensive but this is one of those times that I needed to have GUI elements from different scripts. It just makes my life much easier and GUI is suppose to support depth control. Right now I am using GUI.BringWindowToFront to the element I need on top.

1 Reply

· Add your reply
  • Sort: 
avatar image
5
Best Answer

Answer by Daniel-Brauer · Jul 30, 2010 at 06:33 PM

GUI.Window sorting happens differently from other GUI areas, and as you've discovered, it ignores GUI.depth. The only way you can sort GUI.Windows from a script is by using GUI.BringWindowToFront() and GUI.BringWindowToBack(). If you need to sort all of your windows, you would have to keep track of their unique IDs and call one of these functions on all of them in order.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

1 Person is following this question.

avatar image

Related Questions

Displaying a gameobject over gui issues 0 Answers

gui elements truncated by parent 0 Answers

UI Button order 1 Answer

useGUILayout=false does not honor GUI.depth 0 Answers

How to use GUI.depth to bring a GUI.Box in front of other GUI elements? 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges