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 DarkSlash · Jan 06, 2012 at 06:35 PM · guigameobjecttexture2d

GameObject on top of GUI

I got some GUI Textures, buttons and text in the screen and I want a GameObject to appear in certain occasions(for example, on a click). The things is that the GameObject is render UNDER GUI and not ON TOP.

On this post http://answers.unity3d.com/questions/15386/gameobject-over-gui.html Eric suggests a solution. Anyone got another idea or could explain me how to implement Eric's solution? Because I see that this is a recurrent problem!

Thanks! :)

Comment
Add comment
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

3 Replies

· Add your reply
  • Sort: 
avatar image
4

Answer by saschandroid · Sep 17, 2014 at 10:08 AM

  1. Add a new Layer tag "gui".

  2. gui elements: Set Layer of your gui-elements to "gui"

  3. (first)gui camera: set Culling Mask to "gui" only

  4. add second camera (object camera at the same position as the first camera)

  5. object camera: set Clear Flags to "Depth only".

  6. object camera: set Culling Mask to everything except "gui"

  7. object camera: set Depth to a higher value than gui camera (e.g. gui camera -1, object camera 0)

  8. object camera: uncheck GUILayer

Comment
Add comment · Show 1 · 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
avatar image aditya007 · Oct 22, 2016 at 09:13 AM 0
Share

Perfect step by step answer, Thank you!

avatar image
2

Answer by Anxo · Jan 06, 2012 at 08:30 PM

All he is saying is make a second camera, give it a higher dept than the first camera and set it to dept only. Have the GUI on the lower dept camera and the game object in the higher dept camera. Win.

Comment
Add comment · Show 6 · 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
avatar image DarkSlash · Jan 06, 2012 at 08:44 PM 0
Share

Ok... so...

1) Witch camera should I set to "Depth only"?

2) How do I put de GUI on one camera and the GameObject in another?

Thanks! :)

avatar image Anxo · Jan 06, 2012 at 09:08 PM 0
Share

It looks like you should read this http://unity3d.com/support/documentation/Components/class-Camera.html

just imagine 2 cameras next to each other, one is looking at box A at position x=0, y=0, z=0. The other is looking at box B at position x100 y100 z100. If the first camera is set to depth 1 and the second is set to depth 0 and the first camera is set to depth only, When you hit play, you will see both boxes in the scree. 2 images are rendered by placed on top of each other like paper.

avatar image DarkSlash · Jan 07, 2012 at 06:33 PM 0
Share

Perfect!!! So, if one camera is looking to 100,100,100 should I put the gameobject in that position, don't I? Thanks for helping a newbie! :)

avatar image DarkSlash · Jan 09, 2012 at 01:58 AM 0
Share

Still can't do it. I follow your steps but nothing happens. The GameObject is still rendered behind the GUI.

avatar image aeroson · Jan 17, 2014 at 02:37 PM 1
Share

Remember to set rendering path to Forward on both cameras

Show more comments
avatar image
1

Answer by mononull · Mar 21, 2013 at 09:08 PM

Add second camera, set it to a higher depth, and set clear flags to depth only. If you still have issues you may be forgetting another step. Remove the GUILayer component from the second camera you added if it was there by default. Now this camera will draw the 3D model on top of the other camera drawing the GUI.

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

8 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Same BackGroung For All Screen Resolution 1 Answer

Using GUI and check what button was pressed 1 Answer

Screen.width and Screen.height does not cover screen. Why? 4 Answers

What Is Lighter GameObject or Rect 1 Answer

Game Object enable for game mode selection on GUI 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