- Home /
How to solve GUI Layout problem
I'm trying to implement a score board where players position and score is displayed. I have set the position of the group and put a box inside it with the heading "Top Scores" and 3 labels to be displayed as headers for the players position name and score. However now I am trying to use GUILayout to begin a vertical column to display position numbers 1 to 5 inside the pre defined area. I am getting an error message "error CS1501: No overload for method Label' takes
1' arguments" for each of the labels I have made but as I understand I am not required to provide a position as they are already in the GUILayout. Any ideas why this is going wrong?
void OnGUI()
{
GUI.BeginGroup(new Rect(Screen.width/2-200,Screen.height/4+100,400,1000));
GUI.Box(new Rect(0,0,400,800), "Top Scores");
GUI.Label(new Rect(15,20,100,20), "Position");
GUI.Label(new Rect(100,20,150,20), "Name");
GUI.Label(new Rect(300,20,100,20), "Score");
GUILayout.BeginArea(new Rect(40,50,50,500));
GUILayout.BeginVertical();
GUI.Label("1");
GUI.Label("2");
GUI.Label("3");
GUI.Label("4");
GUI.Label("5");
GUILayout.EndVertical();
GUILayout.EndArea();
GUI.EndGroup();
}
Your answer
Follow this Question
Related Questions
Why do my GUI Layout Buttons not appear on screen? 0 Answers
Why are GUILayout controls started before the BeginArea they are wrapped in? 0 Answers
GUILayout.BeginArea makes problems! 0 Answers
Get Area to Spread Equally with Screen.Height or Screen.Width 2 Answers
Drawing several BeginArea inside a BeginScrollview (GUILayout) produces an unexpected behaviour 1 Answer