Setting IsVisible to 'true' kicks non master players?!

Hi, I'm sure there is a simple reason for this that I'm missing.

My game is entirely playable online at this point. A room is created with a master client and several other clients can join. Great!

But now I'm trying to close off the room once all the players are in (confirmed that PhotonNetwork.CurrentRoom.PlayerCount shows the correct number) and I do:
PhotonNetwork.CurrentRoom.IsOpen = false;

This seems to kick out any other clients that aren't the master from the room. This happens with IsVisible = false too, but not with IsVisible = true. I don't understand, did I not register the players completely with the room possibly?


  • When looking into another option of making custom room properties hold a "isRoomOpen" key/value, it now looks like this happens even when the CurrentRoom gets changed custom room properties... all non-master clients look like their scene gets restarted and they can no longer see the master client within the game. However, I still don't see any reason why this would be happening.
  • Did another deep dive into this today.

    Changing any custom room properties causes the non master clients to restart the scene, but NOT the master client. I even created a meaningless room property called "blahblah" and set that to false... the game works fine up until I set the room properties, using the typical method:
    ExitGames.Client.Photon.Hashtable setValues = new ExitGames.Client.Photon.Hashtable();
                    setValues.Add("blahblah", false);

    I actually added logging to anything that would use the SceneManager.LoadScene or LoadLevel, and I'm seeing nothing. The scene just restarts. This is completely baffling. Why would adding a meaningless room custom property make clients restart their scene?
  • I have solved this issue. When I load a level, I loaded it with PhotonNetwork.LoadLevel("Scenes/<scene_name>"). However, in LoadLevelIfSynced() part of PhotonNetworkPart, because the stored scene name is now just <scene_name>, it reloads it when it compares "Scenes/<scene_name>" with <scene_name>, finds them not equal, and reloads.

    So, seems pretty silly, but I just had to change that scene string to not have the "Scenes/" prefix... not sure where I picked up that habit.
  • Oh. That's a sneaky issue!
    Thanks a lot for the update. That makes a lot of sense now.

    So, all problems solved? You had at least one more thread about loading scenes?
  • 0xhex
    edited October 2022
    1. omg !
    2. i changed this one PhotonNetwork.LoadLevel("CustomTerrain/" + "island_1"); to PhotonNetwork.LoadLevel(2); and no problem!

    please fix this issue photon admins!

    i have spent 12 hour to find this sneaky bug!

  • Dang. Sorry this took you so long.

    PUN 2 sets the active scene name as provided by Unity's SceneManager.GetActiveScene(). Apparently, this doesn't have a path.

    To modify this, find every use of PhotonNetwork.SetLevelInPropsIfSynced() and change what is being passed to it.