|
How can i make a GUI Label or Windows in absolute Middle? in Javascript please ;-) Thanks ;-)
(comments are locked)
|
|
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:
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:
Hope this helps! Right but i need maybe a Windows or a Label White Border ok?
Apr 12 '10 at 03:25 PM
geilman
Oh. I see what you mean. Hang on, I'll update the answer in a sec.
Apr 12 '10 at 04:55 PM
e.bonneville
That won't center the window, though. You need to subtract half the width/height of the window from the x/y coordinates, otherwise the top left of the window will be in the center of the screen, rather than the center of the window. Two more points: 1) I think your left and top positions are flipped in your rects, and 2) Why are you subtracting half the screen from the left and top? Top is 0 in Unity's GUI, so you can just use Rect ((Screen.width / 2) - (contentWidth / 2), (Screen.height / 2) - (contentHeight / 2), contentWidth, contentHeight)
Apr 12 '10 at 08:22 PM
burnumd
(comments are locked)
|
