var cubeToggle : boolean = false;
var window1 : Rect = Rect (20,20,650,300);
var cube3 : Transform;
var cube4 : Transform;
var texture1 : Texture2D;
var texture2 : Texture2D;
function OnGUI()
{
window1 = GUI.Window(0,window1,firstwindow,"LOGIN WINDOW");
if(table9 == true)
{
cubeToggle = GUI.Toggle(Rect(Screen.width*(4.5/6.55),Screen.height*(4/6.3),Screen.width* (1.7/6.55),Screen.height*(1/6.3)),cubeToggle,"CUBE1");
cubeToggle = !GUI.Toggle(Rect(Screen.width*(4.5/6.55),Screen.height*(4.25/6.3),Screen.width*(1.7/6.55),Screen.height*(1/6.3)),!cubeToggle,"CUBE2");
}
}
function firstwindow(windowID : int)
{
if(table7 == true)
{
GUI.Label(Rect(200, 250, 300, 100), "YOU HAVE CLICKED ON:cube1 ");
}
if (table8 == true)
{
GUI.Label(Rect(200, 250, 300, 100), "YOU HAVE CLICKED ON:cube2 ");
}
if (cubeToggle == true)
{
table7 = true;
cube1.renderer.material.mainTexture = texture1;
}
if(!cubeToggle == true)
{
table8 = true;
cube2.renderer.material.mainTexture = texture2;
cubeToggle = false;
}
}
Here my problem is: I have two cubes (cube3 and cube4) with two toggle buttons (cube 1 and cube2) My need is when I click on cube1, toggle button texture should change to texture1; and when I click on cube2, toggle button texture should change to texture2. When cube1 toggle button is clicked, corresponing label should display "you have clicked on cube 1". When cube2 toggle button is clicked, corresponing label should display "you have clicked on cube 2"