using Photon.Pun; using Photon.Realtime; using System.Collections; using System.Collections.Generic; using UnityEngine; public class RoomLayoutGroup : MonoBehaviour { public GameObject roomListingPrefab; public void OnReceivedRoomListUpdate(List roomList) { RemoveOldListings(); foreach (RoomInfo room in roomList) AddRoomListing(room); } private void AddRoomListing(RoomInfo room) { Debug.Log("Room Received for display: " + room.ToString()); GameObject roomListingObj = Instantiate(roomListingPrefab); roomListingObj.GetComponent().roomName = room.Name; roomListingObj.transform.SetParent(transform, false); } private void RemoveOldListings() { foreach (Transform roomListing in transform) Destroy(roomListing.gameObject); } }