- Home /
Why is my GUI pushed over to the right?
My GUI is like alligned or pushed to the right. no matter what the resolution, or anything. I have allignment at middle center.. and everything else is set to 0. So why is it being pushed to the right? Here is how they are being declared.
void OnGUI()
{
//Get the number of the current level. Since the range from 0, 1, 2+
//Add 1 and display it.
int level = Application.loadedLevel + 1;
GUI.Label(new Rect(Screen.width / 2, Screen.height / 2- 175, 125, 25), "Level " + level.ToString(), myStyle);
}
What do you mean by saying 'pushed to the right'? You set it like this: new Rect(Screen.width / 2, Screen.height / 2- 175, 125, 25 So it will start at middle of the screen horizontally, middle $$anonymous$$us 175 px vertically, will be 125 px in width and 25 px in height. I bet you just thought that first two parameters of new Rect() are the center when they are actually are left border and top.
Your answer
Follow this Question
Related Questions
Distribute terrain in zones 3 Answers
Multiple Cars not working 1 Answer
Having issues with "WorldToScreenPoint" 1 Answer
GUI position and size in different screen resolutions 1 Answer
c# - void method from external class. 2 Answers