- Home /
Trouble Positioning a GUILayout.Label, or as a button?
Hey guys, I'm having my trouble positioning my GUILayout.Label (GUILayout.Label("Current Quality Setting: "+QualitySettings.currentLevel)); to the position that I want.
It's currently like this:
http://i43.tinypic.com/1z4a9tf.jpg
(Picture is to big to paste here)
This is the code affiliated with this particular area (I've edited out the 500 lines of menu code that doesn't matter to make it more readable to you guys):
**using UnityEngine; using System.Collections; public class TitleMenu : MonoBehaviour { public bool isMain = true; public bool isOptions = false; public bool isGraphics = false;
public int slboWidth = 220;
public int slboHeight = 210;
public int slbuWidth = 200;
public int slbuHeight = 40;
public int spacing = 10;
void Update()
{
if(Input.GetKeyDown("escape") && isOptions)
{
isOptions = false;
isMain = true;
}
if(Input.GetKeyDown("escape") && isGraphics)
{
isGraphics = false;
isOptions = true;
}
}
void OnGUI()
{
if(isGraphics)
{
GUI.Box(new Rect(Screen.width/2 - slboWidth/2, Screen.height/2 - slboHeight/2, slboWidth, slboHeight), "");
// I Want the QualitySettings.currentLevel (The "Current Quality Setting" string doesn't really matter to me)
GUILayout.Label("Current Quality Setting: "+QualitySettings.currentLevel);
// QualitySettings.currentLevel must go in the button (At the position) created below this line
GUI.Button(new Rect(Screen.width/2 - lboWidth/2 + spacing, Screen.height/2 - slboHeight/2 + spacing, slbuWidth, slbuHeight), "");
if(GUI.Button(new Rect(Screen.width/2 - slboWidth/2 + spacing, Screen.height/2 - slboHeight/2 + 60, slbuWidth, slbuHeight), "Increase"))
{
QualitySettings.IncreaseLevel();
}
if(GUI.Button(new Rect(Screen.width/2 - slboWidth/2 + spacing, Screen.height/2 - slboHeight/2 + 110, slbuWidth, slbuHeight), "Decrease"))
{
QualitySettings.DecreaseLevel();
}
if(GUI.Button(new Rect(Screen.width/2 - slboWidth/2 + spacing, Screen.height/2 - slboHeight/2 + 160, slbuWidth, slbuHeight), "Back"))
{
isGraphics = false;
isOptions = true;
}
}
}
}**
Or:
Any help would be appreciated!
Your answer
Follow this Question
Related Questions
OnGUI Labels affect different boxes? 1 Answer
Why GUI Doesn't appears? 1 Answer
Possible to change GUI.Label fontsize without using GUIStyle? 1 Answer
GUIBox fontSize without changing other labels? 3 Answers
Gui label variable as a string.. 1 Answer