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 sanks007 · Dec 27, 2013 at 08:50 AM · guilayers

Showing a layer with GUI Box(Behind layer) on click of game Object

I have 2 layers on the current scene,One which is visible by default and contain certain GameObjects and custom layer which appear only when those GameObjects are clicked. When this custom Layer appears ,A GUI.BOX should appear behind this layer.But what happens currently is,`GUI.Box` appears on top of everything. While searching for solution, there are certain links which says create another camera and set clear flags to depth Only,Culling Mask to that layer ,Which I did ,but it shows GUI.Box above every layer.

Comment
Add comment · Show 1
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 ArkaneX · Dec 27, 2013 at 09:47 AM 0
Share

The solution with layers/cameras will work in case of GUITexture, but not in case of GUI.Box (or any other GUI elements drawn in OnGUI). These elements are always rendered on the top of everything else.

1 Reply

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

Answer by Patel-Sagar · Dec 27, 2013 at 09:58 AM

You can do this by taking another camera for custom layer, then call 2ndCamera.Render() at last line of GUI() method where you have defined GUI.Box().

This will render camera's 3D view on GUI of 1st camera.

Comment
Add comment · Show 5 · 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 sanks007 · Dec 27, 2013 at 10:16 AM 0
Share

Awesome.. !! worked the way i wanted..!

avatar image ArkaneX · Dec 27, 2013 at 10:17 AM 0
Share

Nice trick!

avatar image sanks007 · Dec 27, 2013 at 10:28 AM 0
Share

Just one question,I have a back button on the scene which appears when the scene loads .When the layer appears ,I am able to click the button which i dont want. Though the action are controlled ,but still I don't to happen that. Is there anyway for it

avatar image Patel-Sagar · Dec 27, 2013 at 11:24 AM 0
Share

sorry buddy i didn't get your question. but if you want to just disable the button, you can do it by setting boolean at scene load in Start function.

avatar image sanks007 · Dec 27, 2013 at 11:41 AM 0
Share

What I mean is :: there is a GUI.Button (Back Button) when the scene loads. Now when the layer appears,I dont want the back button to take any events(Click,Hover etc ). As of now it takes those events so I have to use boolean variable so that it doesn't perform any action. Is there any way that it doesn't take any event at all when the layer is visible.

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

20 People are following this question.

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

Related Questions

Displaying a gameobject over gui issues 0 Answers

Is there a way to change the order of the "Layers" Tab? 0 Answers

How to move GUI objects to separate Camera Layer - and why? 1 Answer

MeshRenderer with GUI/Text Shader is always in front of my 3D objects, how do I fix this? 0 Answers

Displaying a gameobject over gui issues HELP 3 Answers


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