help please before i got silly

i have a small problem

var showWindow = false;
var TheWindow = Rect (20,20,500,500);
var windowRect = Rect (20, 20, 120, 50);
var mySkin : GUISkin;

function Update () {

if (Input.GetKeyDown(“c”)) {
showWindow = true;
Screen.lockCursor = false;
}
}

function OnGUI () {

if (showWindow) {
TheWindow = GUI.Window(0,TheWindow,win, “Status Werte”);
}

}
function win (){

GUI.Button (Rect (20,20,50,50),“Button2”);

GUI.skin = mySkin;
GUI.DragWindow (Rect (0,0, 10000, 20));
}

the code is working but i want if c pressed again the window should be closed
how can i do this???

thx for answer

You need to toggle ‘showWindow’.

Change

showWindow = true;

to

showWindow = !showWindow;

If showWindow is false, it becomes true, and vice versa.

thanks but now i see that the GUI skin dont work

can someone help

You probably want to set GUI.skin before drawing the button.

thanks … now i tried it whis a second script for a second window but it dont work … i dont now ,becous its a second script why dont work it…

first script

var showWindow = false;
var TheWindow = Rect (20,20,500,500);
var windowRect = Rect (20, 20, 120, 50);
var mySkin : GUISkin;

function Update () {

if (Input.GetKeyDown("c")) {
showWindow = !showWindow;
Screen.lockCursor = false;
}
}

function OnGUI () {
GUI.skin = mySkin;

if (showWindow) {
TheWindow = GUI.Window(0,TheWindow,win, "Status Werte");
}

}
function win (){

GUI.Button (Rect (20,20,50,50),"Button2");
GUI.DragWindow (Rect (0,0, 10000, 20));
}

second script

var showWindow = false;
var TheWindow = Rect (20,20,500,500);
var windowRect = Rect (20, 20, 120, 50);
var mySkin : GUISkin;

function Update () {

if (Input.GetKeyDown("o")) {
showWindow = !showWindow;
Screen.lockCursor = false;
}
}

function OnGUI () {
GUI.skin = mySkin;

if (showWindow) {
TheWindow = GUI.Window(0,TheWindow,win, "Status Werte");
}

}
function win (){

GUI.Button (Rect (20,20,50,50),"Button2");
GUI.DragWindow (Rect (0,0, 10000, 20));
}

can someone help please…