GUI issues

Im using photon unity networking and i can’t figure out a good way of displaying all the games so you can choose one to join, currently you can search for a game and it will show up but what is the best way of spacing out the buttons because if two games have a similair name then they appear on top of each other, i don’t see how i could do it efficiently, here is my code so far:

using UnityEngine;
using System.Collections;

public class RoomMechanics : MonoBehaviour {
	
	public string InputField;
	void Start () 
	{
		foreach (RoomInfo room in PhotonNetwork.GetRoomList()) 
		{
			//Debug.Log(room);
		}
	}
	
	void OnGUI()
	{

		InputField=GUI.TextField (new Rect((Screen.width/2)-125,Screen.height/100,250,25),InputField);

			foreach( RoomInfo room in PhotonNetwork.GetRoomList())
			{

				if(InputField!="")
				{
					if(room.name.ToString().Contains(InputField))
					{
						if(GUI.Button (new Rect((Screen.width/2)-125,300,250,50),room.name))
						{
							
						}



					}
				}	
				


			}

	}
}

Buddy…
The Rect() function in Unity has the following definition:

 Rect(float x,float y,float width,float height)

So. The problem in your code is that you are always specifying the same x and y location for the button of different rooms.
You need to have some counter to give different positions for x or y or both.

For example:

float yPosition = 300;
foreach( RoomInfo room in PhotonNetwork.GetRoomList())
{
    if(InputField!="")
    {
        if(room.name.ToString().Contains(InputField))
        {
             if(GUI.Button (new Rect((Screen.width/2)-125,yPosition,250,50),room.name))
             {
             }
        }
        yPosition += 75;
    }
}

Updating the yPosition separates the buttons.

Mark the question solved, if this solves your problem.

PS: it has nothing to do with rooms having same name…