I have a GUI Window that contains Labels and a Button that changes the content of the Labels. When I click the button, the Labels change, but so does the GUI Skin it also happens when I click on the window itself… Here’s the whole script and below that it’s just the variable and scripts that involve the GUI Window.
var menu = 0;
var chapterSelection = 0;
var _CourtNotes = 0;
var chapter = "Turnabout Beginnings";
var top : GameObject;
var bottom : GameObject;
var chaptertop : Material;
var chapterbottom : Material;
var selection : GUISkin;
var courtNotes : GUISkin;
var selected : AudioClip;
var loadAvailable = PlayerPrefs.GetString("loadAvailable");
var turnabout = PlayerPrefs.GetInt("turabout");
function OnGUI () {
GUI.skin = courtNotes;
GUI.Window(0, Rect (450,50,325,500), CourtNotes, "", GUI.skin.GetStyle("window"));
GUI.skin = selection;
if (menu == 0) {
if (GUI.Button (Rect (50,375,300,40), "New Game")) {
audio.PlayOneShot(selected);
menu = 1;
}
if(loadAvailable == "true"){
if (GUI.Button (Rect (50,475,300,40), "Continue")) {
audio.PlayOneShot(selected);
menu = 2;
}
}
} else if (menu == 1) {
top.renderer.material = chaptertop;
bottom.renderer.material = chapterbottom;
if (chapterSelection == 0) {
chapter = "Turnabout Beginnings";
}
if (GUI.Button (Rect (50,400,300,100), chapter)) {
if (chapterSelection == 0){
} else if (chapterSelection == 1) {
} else if (chapterSelection == 2) {
} else if (chapterSelection == 3) {
} else if (chapterSelection == 4) {
}
}
if (chapterSelection > 0) {
}
if (chapterSelection != turnabout){
}
} else if (menu == 2) {
if (GUI.Button (Rect (50,375,300,40), "From chpt. start")) {
}
}
}
function CourtNotes () {
if (_CourtNotes == 0) {
GUILayout.Label("DISCLAIMER:");
GUILayout.Label("Stuff");
GUILayout.Label("THE SIDE BAR:");
GUILayout.Label("More Stuff");
if (GUI.Button (Rect (20,440,285,50), "Credits")) {
_CourtNotes = 1;
}
} else if (_CourtNotes == 1) {
GUILayout.Label("CREDITS:");
GUILayout.Label("Stuff");
GUILayout.Label("More Stuff");
if (GUI.Button (Rect (20,440,285,50), "Back")) {
_CourtNotes = 0;
}
}
}
var _CourtNotes = 0;
var courtNotes : GUISkin;
function CourtNotes () {
if (_CourtNotes == 0) {
GUILayout.Label("DISCLAIMER:");
GUILayout.Label("Stuff");
GUILayout.Label("THE SIDE BAR:");
GUILayout.Label("More Stuff");
if (GUI.Button (Rect (20,440,285,50), "Credits")) {
_CourtNotes = 1;
}
} else if (_CourtNotes == 1) {
GUILayout.Label("CREDITS:");
GUILayout.Label("Stuff");
GUILayout.Label("More Stuff");
if (GUI.Button (Rect (20,440,285,50), "Back")) {
_CourtNotes = 0;
}
}
}
Before you ask, I did set the GUISkin to the desired background for Normal, Active, Hover, AND Focused, and it still doesn’t work.