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 48 56

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

1 answer: sort oldest

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 180 142 163

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:

x5753
x4830
x2217
x599
x151

asked: Jul 13, 2010 at 12:52 AM

Seen: 2689 times

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