- Home /
Resize Gui
So I created something basic that has around 6-7 buttons. It works fine fullscreen with the executable but if you we're doing this for androids and you got a different sized phone or your doing it for pc and your using the webplayer the buttons wont all show.
They are built for a size and if you have a smaller screen such as 600x400 instead of 1920x1080 you will see nowhere near as many buttons but you will see all of the game.
Anyone know how to fix this?
Answer by mohanrao164 · Nov 19, 2011 at 08:32 AM
use Screen.width and Screen.height for declaring
for example
if (GUI.Button (new Rect (400,135,50,40),"Button1"))
{
//any code
}
the same button code can be written in the below format .
from the below code the button can be adjusted to any resolution
if (GUI.Button (new Rect(Screen.width/1.2f,Screen.height/2.4f,Screen.width/9.6f,Screen.height/7.6f),"Button1"))
{
//any code
}
Your answer
Follow this Question
Related Questions
Working health script? 2 Answers
Scale Animation 1 Answer
How can I resize an image and save it to disk ? 6 Answers
Help Changing GUI Text size 0 Answers
Can you update the application while resizing the window? 0 Answers