So here i´m again, i have this menu with GUI toggle buttons,each button open a window when i click on them, is there a way to uncheck one when the other is clicked?
if yes what is the script and where should i put it
thanks in advance
this is the script i have
[11529-toggle+button.jpg|11529]
using UnityEngine;
using System.Collections;
public class SkinTest : MonoBehaviour
{
public GUISkin thisAmigaGUISkin;
public bool doWindow1 = true;
public bool doWindow2 = true;
public bool doWindow3 = true;
public bool doWindow4 = true;
public bool doWindow5 = true;
public bool doWindow6 = true;
public bool doWindow7 = true;
public bool doWindow8 = true;
public bool doWindow9 = true;
public bool doWindow10 = true;
private Vector2 scrollPosition1 = Vector2.zero;
private Vector2 scrollPosition2 = Vector2.zero;
private Vector2 scrollPosition3 = Vector2.zero;
private Vector2 scrollPosition4 = Vector2.zero;
private Vector2 scrollPosition5 = Vector2.zero;
private Vector2 scrollPosition6 = Vector2.zero;
private Vector2 scrollPosition7 = Vector2.zero;
private Vector2 scrollPosition8 = Vector2.zero;
private Vector2 scrollPosition9 = Vector2.zero;
void Update() {
if (Input.GetKeyUp(KeyCode.M))
doWindow1 = !doWindow1;
}
// Window 1
void DoWindow1(int windowID) {
//Buttons Inside Window 1
GUI.Box(new Rect(10, 30, 230, 20), "");
GUI.Box(new Rect(10, 52, 230, 20), "");
GUI.Box(new Rect(10, 74, 230, 20), "");
GUI.Box(new Rect(10, 96, 230, 20), "");
GUI.Box(new Rect(10, 118, 230, 20), "");
GUI.Box(new Rect(10, 140, 230, 20), "");
GUI.Box(new Rect(10, 162, 230, 20), "");
GUI.Box(new Rect(10, 184, 230, 20), "");
GUI.Box(new Rect(10, 208, 230, 20), "");
doWindow2 = GUI.Toggle(new Rect(10, 30, 230, 20), doWindow2, "");
doWindow3 = GUI.Toggle(new Rect(10, 52, 230, 20), doWindow3, "");
doWindow4 = GUI.Toggle(new Rect(10, 74, 230, 20), doWindow4, "");
doWindow5 = GUI.Toggle(new Rect(10, 96, 230, 20), doWindow5, "");
doWindow6 = GUI.Toggle(new Rect(10, 118, 230, 20), doWindow6, "");
doWindow7 = GUI.Toggle(new Rect(10, 140, 230, 20), doWindow7, "");
doWindow8 = GUI.Toggle(new Rect(10, 162, 230, 20), doWindow8, "");
doWindow9 = GUI.Toggle(new Rect(10, 184, 230, 20), doWindow9, "");
doWindow10 = GUI.Toggle(new Rect(10, 208, 230, 20), doWindow10, "");
GUI.backgroundColor = Color.green;
GUI.Button(new Rect(30, 30, 210, 20), "Arca Del Testimonio");if (doWindow2)
GUI.Window(2, new Rect(265, 32, 400, 500), DoWindow2, "ARCA DEL TESTIMONIO Exodo 25:10-22 (RVR1960)");
GUI.backgroundColor = Color.red;
GUI.Button(new Rect(30, 52, 210, 20), "Mesa De Los Panes");if (doWindow3)
GUI.Window(3, new Rect(265, 32, 400, 500), DoWindow3, "MESA DE LOS PANES EXODO 25:23-30 (RVR1960)");
GUI.backgroundColor = Color.yellow;
GUI.Button(new Rect(30, 74, 210, 20), "El Candelero De Oro");if (doWindow4)
GUI.Window(4, new Rect(265, 32, 400, 500), DoWindow4, "EL CANDELERO DE ORO EXODO 25:31-40 (RVR1960)");
GUI.backgroundColor = Color.white;
GUI.Button(new Rect(30, 96, 210, 20), "El Tabernaculo");if (doWindow5)
GUI.Window(5, new Rect(265, 32, 400, 500), DoWindow5, "EL TABERNACULO EXODO 26:1-37 (RVR1960) ");
GUI.backgroundColor = Color.green;
GUI.Button(new Rect(30, 118, 210, 20), "El Altar De Bronce");if (doWindow6)
GUI.Window(6, new Rect(265, 32, 400, 500), DoWindow6, "EL ALTAR DE BRONCE EXODO 27:1-8 (RVR1960) ");
GUI.backgroundColor = Color.red;
GUI.Button(new Rect(30, 140, 210, 20), "El Atrio Del Tabernaculo");if (doWindow7)
GUI.Window(7, new Rect(265, 32, 400, 500), DoWindow7, "EL ATRIO DEL TABERNACULO EXODO 27:9-19 (RVR1960) ");
GUI.backgroundColor = Color.yellow;
GUI.Button(new Rect(30, 162, 210, 20), "El Altar Del Incienso");if (doWindow8)
GUI.Window(8, new Rect(265, 32, 400, 500), DoWindow8, "EL ALTAR DEL INCIENSO EXODO 30:1-10 (RVR1960) ");
GUI.backgroundColor = Color.white;
GUI.Button(new Rect(30, 184, 210, 20), "La Fuente De Bronce");if (doWindow9)
GUI.Window(9, new Rect(265, 32, 400, 500), DoWindow9, "LA FUENTE DE BRONCE EXODO 30:17-21 (RVR1960) ");
GUI.backgroundColor = Color.green;
GUI.Button(new Rect(30, 208, 210, 20), "Las Tribus En El Santuario");if (doWindow10)
GUI.Window(10, new Rect(265, 32, 400, 500), DoWindow10, "LAS TRIBUS En NUMEROS 2:1-34 (RVR1960) ");
}
void OnGUI() {
GUI.Box(new Rect(10,10,180,20), " Menu Del Santuario On/Off");
doWindow1 = GUI.Toggle(new Rect(10, 10, 180, 20), doWindow1, "");
if (doWindow1)
GUI.Window(0, new Rect(10, 32, 250, 500), DoWindow1, "EL SANTUARIO EXODO 25:10 - 30:21");
}
//Window 2
void DoWindow2(int windowID) {
GUI.backgroundColor = Color.magenta;
scrollPosition1 = GUI.BeginScrollView(new Rect(10, 20, 385, 475), scrollPosition1, new Rect(-300,20, 275, 6750));
GUI.backgroundColor = Color.red;
if (GUI.Button(new Rect(-300, 22, 140, 18), "Mesa De Los Panes"))
GUI.ScrollTo(new Rect(0, 1157, 100, 20));
GUI.EndScrollView();
}
void OnGUI2() {
}
//Window3
void DoWindow3(int windowID) {
GUI.backgroundColor = Color.cyan;
scrollPosition2 = GUI.BeginScrollView(new Rect(10, 20, 385, 475), scrollPosition2, new Rect(-300,20, 275, 6750));
GUI.EndScrollView();
}
void OnGUI3() {
}
//Window4
void DoWindow4(int windowID) {
GUI.backgroundColor = Color.magenta;
scrollPosition3 = GUI.BeginScrollView(new Rect(10, 20, 385, 475), scrollPosition3, new Rect(-300,20, 275, 6750));
GUI.EndScrollView();
}
void OnGUI4() {
}
//Window5
void DoWindow5(int windowID) {
GUI.backgroundColor = Color.cyan;
scrollPosition4 = GUI.BeginScrollView(new Rect(10, 20, 385, 475), scrollPosition4, new Rect(-300,20, 275, 6750));
GUI.EndScrollView();
}
void OnGUI5() {
}
//Window6
void DoWindow6(int windowID) {
GUI.backgroundColor = Color.white;
scrollPosition5 = GUI.BeginScrollView(new Rect(10, 20, 385, 475), scrollPosition5, new Rect(-300,20, 275, 6750));
GUI.EndScrollView();
}
void OnGUI6() {
}
//Window7
void DoWindow7(int windowID) {
GUI.backgroundColor = Color.cyan;
scrollPosition6 = GUI.BeginScrollView(new Rect(10, 20, 385, 475), scrollPosition6, new Rect(-300,20, 275, 6750));
GUI.EndScrollView();
}
void OnGUI7() {
}
//Window8
void DoWindow8(int windowID) {
GUI.backgroundColor = Color.magenta;
scrollPosition7 = GUI.BeginScrollView(new Rect(10, 20, 385, 475), scrollPosition7, new Rect(-300,20, 275, 6750));
GUI.EndScrollView();
}
void OnGUI8() {
}
//Window9
void DoWindow9(int windowID) {
GUI.backgroundColor = Color.cyan;
scrollPosition8 = GUI.BeginScrollView(new Rect(10, 20, 385, 475), scrollPosition8, new Rect(-300,20, 275, 6750));
GUI.EndScrollView();
}
void OnGUI9() {
}
//Window10
void DoWindow10(int windowID) {
GUI.backgroundColor = Color.white;
scrollPosition9 = GUI.BeginScrollView(new Rect(10, 20, 385, 475), scrollPosition9, new Rect(-300,20, 275, 6750));
GUI.EndScrollView();
}
void OnGUI10() {
}
}