Cannot Join Created Room [SOLVED]

Options
I've created a Photon PUN 2 application.
It's successfully connecting to the server, connecting to the lobby and creating a room.
But when I try to open two instances of the application and create a room, the OnRoomListUpdate method isn't being called on the other instance and when I try to join it calls OnJoinRoomFailed with an error saying that the room doesn't exist.

devihhk.png
JHvobUn.png
jrcUpMt.png

The "0" is the number of rooms that it's finding.
Am using just the word "test" for creating and joining the room, so I'm pretty sure that it's not that the names aren't matching up as far as I can tell. Probably missing something silly but I'm at my wit's end for trying to figure this out on my own.

Comments

  • Keely
    Options
    If you need the code in text format for copying:
    void Start()
        {
            if(Instance == null)
            {
                Instance = this;
            }
    
            if (!PhotonNetwork.IsConnected)
            {
                print("Connecting to server..");
                PhotonNetwork.ConnectUsingSettings();
            }
    
        }
    
        public override void OnConnectedToMaster()
        {
            print("Connected to the server.");
            MainMenuButtons.Instance.ConnectedToServer();
            PhotonNetwork.AutomaticallySyncScene = false;
        }
    
        public override void OnJoinedLobby()
        {
            print("Joined lobby.");
            if (!PhotonNetwork.InRoom)
            {
                MainMenuButtons.Instance.JoinedLobby();
            }
        }
    
        public override void OnRoomListUpdate(List<RoomInfo> roomList)
        {
            Debug.Log(roomList.Count);
        }
    
    
        public void JoinLobby()
        {
            if (!PhotonNetwork.JoinLobby(TypedLobby.Default))
            {
                Debug.Log("Failed to join lobby.");
            }
            
        }
    
        public void JoinRoom(string roomName)
        {
            Debug.Log("Trying to join room.");
            if (!PhotonNetwork.JoinRoom(roomName))
            {
                Debug.Log("Failed to join room.");
            }
        }
    
        public void LeaveLobby()
        {
            PhotonNetwork.LeaveLobby();
            MainMenuButtons.Instance.LeftLobby();
        }
    
        public void LeaveRoom()
        {
            PhotonNetwork.LeaveRoom();
            MainMenuButtons.Instance.LeftRoom();
        }
    
        public override void OnJoinedRoom()
        {
            print("Joined room.");
            MainMenuButtons.Instance.JoinedRoom();
    
            foreach (Transform child in transform)
            {
                Destroy(child.gameObject);
            }
    
            Player[] photonPlayers = PhotonNetwork.PlayerList;
    
            foreach (Player photonPlayer in photonPlayers)
            {
                MainMenuButtons.Instance.PlayerListings.PlayerJoinedRoom(photonPlayer);
            }
        }
    
        public bool CreateRoom(string roomName)
        {
            if (roomnames.Contains(roomName))
            {
                return false;
            }
    
            RoomOptions roomOptions = new RoomOptions() { IsVisible = true, IsOpen = true, MaxPlayers = 3 };
    
            PhotonNetwork.CreateRoom(roomName, roomOptions, TypedLobby.Default);
            Debug.Log("Creating room.");
            return true;
        }
    
  • irolenze
    irolenze
    edited March 2020
    Options
    I'm sorry but what exactly was the solution?
    I am having the exact same issue! The application creates and connects to the room but then when I try to join with others it shows to be creating the room again and when I display the total number of rooms it shows 0 (yes, even after it has connected to the room and hasgone through the OnJoinedRoom). If I list the number of players in the room it shows only 1 player.
    Mind you that everything was working yesterday...

    EDIT: I don't know why but every thing is working when I connect to the application with an instance running on my phone... It is what I intend to do with the final product so I can work with this but it was working correctly yesterday running on pc too...
  • I'm also having this exact issue, was there any resolution to this?

  • Brainlocks
    edited December 2022
    Options

    This worked for me. I've been struggling with this for the past 3 hours. It worked yesterday and then suddenly stopped today. Here are some steps that might work for you (the code snippet is what ultimately worked best for me):

    (Add the code snippet FIRST) Sorry I couldn't figure out how to format it properly.

    1. Switch your build file from your OneDrive folder to your Local disk C folder. This should work if you are experiencing the bug where it works in the Unity editor but not in the build. OneDrive automatically autosaves which could be messing with photon on your computer.
    2. In your connect to server script make sure that Start void is private, and that the OnConnectedToMaster AND OnJoinedLobby both start with public override void. People often forget to add override which can lead to issues.
    3. Restart Computer/ Home network/Unity.
    4. Download the 2022 version of unity or some other compatible version
    5. Make sure that your player prefab is in a folder specifically named "Resources" with a capital R. Photon WILL NOT load your character for other players if it is not in the "Resources" tab.
    6. Good Luck!

    dm me @getbenking on twitter if this doesn't work for you.

    Inside your Create and Join script add this
    
    void Start()
        {
            
    if (!PhotonNetwork.IsConnected)
            {
                print("Connecting to server..");
                PhotonNetwork.ConnectUsingSettings();
            }