- Home /
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;
}
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.
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.
@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
Follow this Question
Related Questions
Gui overlapping camera on camera 1 Answer
Quick GUI Texture Question 0 Answers
Problem With GUI Circle Thickness 0 Answers
9-Sliced Legacy GUI 2 Answers
unity make a skin/texture to a character like the robot from the fps tutorial 1 Answer