GUILayout, need help.

Display server list code

		if (MasterServer.PollHostList().Length != 0){
			HostData[] hostData = MasterServer.PollHostList();
			
			int i = 0;	
			
			while (i < hostData.Length){
					GUILayout.BeginArea (new Rect(Screen.width - 400,15, 350, Screen.height - 100),"Server List", "Box");
					GUILayout.Space(25);
					GUILayout.Label ("Match Name" + "     " + "Players" + "     " + "Current Map");						
					GUILayout.BeginHorizontal("box");
					GUILayout.Label (hostData[i].gameName + "     |     " + hostData[i].connectedPlayers +"/"+ + hostData[i].playerLimit + "      |      " + "   Map");
					if (GUILayout.Button ("Connect"))
					{
						Network.Connect (hostData[i]);
					}
					GUILayout.EndHorizontal();
					
					GUILayout.EndArea();
					
					i++;
				}
			}

it works fine, but if there is more then 1 server, their Horizontal group displaying in the same Rect. How can I make it displaying under each other.
I know, there is Vertical groups and Scrollview, but I broke my head trying use it in this case.

Try moving the BeginArea and EndArea outside of the loop

BeginArea

while loop

EndArea

Here is another try, but wrong again…

		if (MasterServer.PollHostList().Length != 0){
			HostData[] hostData = MasterServer.PollHostList();
			
			int i = 0;	
			
			GUILayout.BeginArea (new Rect(Screen.width - 400,15, 350, Screen.height - 100),"Server List", "Box");
			
			while (i < hostData.Length){
//					GUILayout.BeginArea (new Rect(Screen.width - 400,15, 350, Screen.height - 100),"Server List", "Box");
					GUILayout.Space(25);
					GUILayout.Label ("Match Name" + "     " + "Players" + "     " + "Current Map");	
				
				foreach (HostData data in hostData){
					ScrollServers = GUILayout.BeginScrollView (ScrollServers, GUILayout.MaxWidth (300));
					
					GUILayout.BeginHorizontal("box");
					GUILayout.Label (hostData[i].gameName + "     |     " + hostData[i].connectedPlayers +"/"+ + hostData[i].playerLimit + "      |      " +currentLevel);
					if (GUILayout.Button ("Connect"))
					{
						Network.Connect (hostData[i]);
					}
					GUILayout.EndHorizontal();
					
//					GUILayout.EndArea();
					
					i++;
					
					GUILayout.EndScrollView();
				}
			}
			GUILayout.EndArea();
		}

And here is what I’ve got

Problem solved

		if (MasterServer.PollHostList().Length != 0){
			HostData[] hostData = MasterServer.PollHostList();
			
			int i = 0;	
			
			GUILayout.BeginArea (new Rect(Screen.width - 400,15, 350, Screen.height - 100),"Server List", "Box");
			GUILayout.Space(25);
			GUILayout.Label ("Match Name" + "     " + "Players" + "     " + "Current Map");	
				
				foreach (HostData data in hostData){
					ScrollServers = GUILayout.BeginScrollView (ScrollServers, GUILayout.MaxWidth (400));
					
					while (i < hostData.Length){
					
					GUILayout.BeginHorizontal("box");
					GUILayout.Label (hostData[i].gameName + "     |     " + hostData[i].connectedPlayers +"/"+ + hostData[i].playerLimit + "      |      " +currentLevel);
					if (GUILayout.Button ("Connect"))
					{
						Network.Connect (hostData[i]);
					}
					GUILayout.EndHorizontal();
					
					i++;
				}
					
					GUILayout.EndScrollView();
				
			}
			GUILayout.EndArea();
		}

Put the scrollview stuff outside of the loop too.