How can i make a GUI Label or Windows in absolute Middle?

How can i make a GUI Label or Windows in absolute Middle?

in Javascript please ;-)

Thanks ;-)

I'm not sure what you want your label in the middle of, but I'm assuming your talking about the screen. In that case, try this script, which will put a window in the center of the screen:

var windowRect : Rect = Rect (Screen.height - (Screen.height/2), Screen.width -      (Screen.width/2), 100, 30);

function OnGUI () {
    windowRect = GUI.Window (0, windowRect, WindowFunction, "My Window");
}

function WindowFunction (windowID : int) {
    // Draw any Controls inside the window here
}

That should do the trick, but correct me if I'm wrong!

Also, here's a script to put a plain box in the center of the screen:

function OnGUI () {
    GUI.Label (Rect (Screen.height - (Screen.height/2), Screen.width -      (Screen.width/2), 100, 30), "Hi. I'm a plain box.");
}

Hope this helps!

var windowRect : Rect = Rect (Screen.width/2 - thisObjectWidth/2, Screen.height/2 - thisObjectHeight/2, thisObjectWidth, thisObjectHeight);