I am having a big problem as for some reason when one player creates the room, the other player cannot join
please help. I think it could be to do with the way i set it up but unsure :/.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
public class NetworkManager : MonoBehaviour {
private RoomInfo[] roomsList;
public GameObject player;
void Start()
{
PhotonNetwork.ConnectUsingSettings ("0.1");
}
void OnGUI()
{
if (!PhotonNetwork.connected) {
GUILayout.Label (PhotonNetwork.connectionStateDetailed.ToString ());
} else if (PhotonNetwork.room == null) {
if (GUI.Button (new Rect (100, 100, 250, 100), "Start Server")) {
PhotonNetwork.CreateRoom ("Bumpie Room", new RoomOptions (){ MaxPlayers = 15 }, null);
}
}
if (roomsList != null)
{
for (int i = 0; i < roomsList.Length; i++)
{
if(GUI.Button(new Rect(100,250 + (110 * i), 250, 100), "Join ThisRoom" + roomsList[i].Name)){
PhotonNetwork.JoinRoom(roomsList[i].Name);
}
}
}
}
void OnRecievedRoomListUpdate()
{
roomsList = PhotonNetwork.GetRoomList ();
}
void OnJoinedRoom()
{
Debug.Log ("Connected To The Room");
PhotonNetwork.Instantiate (player.transform.name, Vector3.zero, Quaternion.identity, 0);
}
}