Hi there,
This is my first attempt at programming a Unity application, so I am lumbering around a little bit like a blind giant. I’m sure it is a very simple answer, and that I am approaching it incorrectly, but I have objects in a room, that when they are clicked on start a GUI that gives more information on the object. Some of the objects have two pages of info, so I have a GUI button that is pressed to get to the second page. WhenMy current code is fine for changing the GUI Style background, but when I exit the info screen, and click on the object again, it is stuck on the second page of info and I can’t seem to code it to reset the GUI Style on the start of the infomation.
As I have already found a lot of great info on these pages, I was wondering whether somebody may be able to help me.
I will post my code, please no sniggering.
Thanks,
Tom
var aTexture : GUIStyle;
var CustomSkin1 : GUIStyle;
var CustomSkin2 : GUIStyle;
var CustomSkin3 : GUIStyle;
var CustomSkin4 : GUIStyle;
var CustomSkin5 : GUIStyle;
var loadLevel : String = "Level1";
var openGUI : boolean = false;
var Ceiling : GameObject;
function OnMouseDown(){
openGUI = true;
CustomSkin1.fixedWidth = Screen.width;
CustomSkin1.fixedHeight = Screen.height;
Ceiling.active = true;
GUI.skin = null;
}
function OnGUI () {
if(openGUI)
{
// Make a background box
GUI.depth = 0;
GUI.Box (Rect (0,0,Screen.width,Screen.height), "", CustomSkin1);
if (GUI.Button (Rect (Screen.width * 0.92,Screen.height * 0.0001,50,50),"", CustomSkin2)) {
openGUI = false;
Debug.Log("Clicked Off");
}
if (GUI.Button (Rect (Screen.width * 0.92,Screen.height/10,50,50),"", CustomSkin3)) {
Debug.Log("Clicked Arrow");
CustomSkin1 = CustomSkin4;
//GUI.skin.box = CustomSkin4;
}
}
else openGUI = false;
}