- Home /
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!
Answer by MikezNesh · Jul 13, 2010 at 01:04 AM
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
Your answer
Follow this Question
Related Questions
controll acceleration with gui button 1 Answer
What is the best way to resize textures on the GUI? 3 Answers
Stand alone player 0 Answers
I have problem when i want to using button instead keyboard in iOS 1 Answer
Gui Toggle help 2 Answers