x


Make this GUI Bigger?

Okay, so I got this script off of the unity website, but how do I make it fill up the whole screen? So here's the script;

/ Example level loader /

function OnGUI () { // Make a background box GUI.Box (Rect (10,10,100,90), "Menu");

 // Make the first button. If it is pressed, Application.Loadlevel (1) will be executed
 if (GUI.Button (Rect (20,40,80,20), "Play")) {
     Application.LoadLevel (1);
 }

 // Make the second button.
 if (GUI.Button (Rect (20,70,80,20), "Menu")) {
     Application.LoadLevel (0);
 }

}

This is probably a simple question, but I really need it. And make sure the text is bigger too. Thanks!

more ▼

asked Jul 13, 2010 at 12:52 AM

Collinbxyz gravatar image

Collinbxyz
114 51 50 58

(comments are locked)
10|3000 characters needed characters left

1 answer: sort newest

All you have to do is set the rectangle values to screen.height and screen.width like so:

Rect(0, 0, Screen.width, Screen.height);

Note when doing this make sure you declare the variable inside the OnGUI function.

For the GUI font you need to import a bigger font size or create a style. This link will help: http://answers.unity3d.com/questions/6585/change-gui-font-size-and-color

more ▼

answered Jul 13, 2010 at 01:04 AM

MikezNesh gravatar image

MikezNesh
993 181 150 166

Okay, thanks,I got it

Jul 13, 2010 at 02:58 PM Collinbxyz
(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5998
x5001
x2229
x623
x159

asked: Jul 13, 2010 at 12:52 AM

Seen: 2753 times

Last Updated: Nov 05, 2010 at 11:15 PM