• 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
Question by calisteez916 · Nov 10, 2012 at 12:33 AM · guitexturehierarchyoverlapoverlay

GUIs overlapping other GUIs

Hi,

I'm having a little bit of trouble trying to create category GUI buttons. Each GUI has its own script in it. In this case I'll talk about CAT200 and CAT400. I want each CAT to be clickable and once clicked have a GUI texture overlap each GUI button. My CAT200 is working flawless, however when I click on CAT400 the texture overlaps but the CAT200 is not being overlapped, meaning, it's still showing.

Each gameobject has the same code below. Except the coordinates are of course different from each other

 var showMoreGui = false; 
 var icon : Texture2D;
 var next : Texture2D;
 var exit : Texture2D;
 var Question : Texture2D;
 var Answer : Texture2D;
 
 var menuNumber = 0;
 
 function OnGUI() 
 {
             switch(menuNumber)
             {
             case 0:
             icon200();
             break;
             case 1:
             question200();
             break;
             case 2:
             answer200();
             break;
             case 3:
             delete200();
             break;
     }
 } 
 function icon200()
 {
     if (GUI.Button (Rect (100,270, 150,100), icon)) 
         menuNumber = 1;
 }
 
 
 function question200 ()
 { 
     (GUI.DrawTexture (Rect (100,10, 1050,750), Question));
     if (GUI.Button (Rect (1150,10, 150,100), next))
     menuNumber = 2;
     if (GUI.Button (Rect (1150,110, 150,100), exit))
     menuNumber = 0;
    
 } 
 
 function answer200()
 {
             (GUI.DrawTexture (Rect (100,10, 1050,750), Answer));
             if (GUI.Button (Rect (1150,110, 150,100), exit))
     menuNumber = 3;
 }
 
 function delete200()
 {
             enabled = false;
 }
     
Comment
aldonaletto

People who like this

1 Show 0
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

2 Replies

· Add your reply
  • Sort: 
avatar image

Answer by ZeroBeat99 · Nov 13, 2012 at 10:03 PM

You may want to try Gui.Depth. I'm not to sure if that will help but it's worth a shot.

Comment
aldonaletto

People who like this

1 Show 0 · 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

Answer by calisteez916 · Nov 14, 2012 at 12:26 AM

Bump. I'm still having this problem if anyone can help me please. Like I said in my post the category buttons are displaying and when I click on category 200 the answer GUI overlaps and covers both the category 200 and category 400 but when I click on the category 400 button the answer GUI for the category 400 overlaps the category 400 button but not the category 200 button. Is there a way to disable the script? Or am I coding this all wrong. I only have basic knowledge in C++. So, I'm sorry to be troubling you guys. I would love to learn though. Thanks in advance.

Comment

People who like this

0 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 aldonaletto · Nov 14, 2012 at 12:32 AM 0
Share

@ZeroBeat99 seems to have the right answer - have you tried it? Read http://docs.unity3d.com/Documentation/ScriptReference/GUI-depth.html to get more info about this.

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.

Welcome to Unity Answers

If you’re new to Unity Answers, please check our User Guide to help you navigate through our website and refer to our FAQ for more information.

Before posting, make sure to check out our Knowledge Base for commonly asked Unity questions.

Check our Moderator Guidelines if you’re a new moderator and want to work together in an effort to improve Unity Answers and support our users.

Follow this Question

Answers Answers and Comments

11 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

Related Questions

Gui overlapping camera on camera 1 Answer

Quick GUI Texture Question 0 Answers

How to hide the enemy's health bar until the player enters the enemy collier? 2 Answers

How to color only a specific GUI.Box 1 Answer

Editor scripting: Part of a texture as button content 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