Photon Instantiating previously loaded objects when I use ReJoinRoom

Options
I am trying to rejoin a room (to support the case of the network connection getting cut when when going to the home screen on an iPhone)

I am creating my room like this:

PhotonNetwork.UsePrefabCache= true;

		var room_options = new RoomOptions();
		room_options.PlayerTtl = 5 * 1000;
		room_options.EmptyRoomTtl = 5 * 1000;
		<b class="Bold">room_options.CleanupCacheOnLeave = false;</b>
		room_options.PublishUserId = true;
		room_options.MaxPlayers = 8;

		PhotonNetwork.JoinOrCreateRoom(room_name,room_options,new TypedLobby("SQL_LOBBY",LobbyType.SqlLobby));
When I use ReJoinRoom after a disconnection it seems all of my PhotonNetwork instantiated objects ( which are still loaded into memory due to room_options.CleanupCacheOnLeave = false ) are trying to be instantiated again and produces many PhotonView ID duplicate found errors. Here is the stack:
PhotonView ID duplicate found: 2. New: View (0)2 on obj_hdqr_0_0_00_00(Clone) (scene) old: View (0)2 on obj_hdqr_0_0_00_00(Clone) (scene). Maybe one wasn't destroyed on scene load?! Check for 'DontDestroyOnLoad'. Destroying old entry, adding new.
UnityEngine.Debug:LogError(Object)
NetworkingPeer:RegisterPhotonView(PhotonView) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:3410)
PhotonView:Awake() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonView.cs:269)
UnityEngine.Object:Instantiate(GameObject, Vector3, Quaternion)
NetworkingPeer:DoInstantiate(Hashtable, PhotonPlayer, GameObject) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:3088)
NetworkingPeer:OnEvent(EventData) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:2409)
ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[])
ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:157)
I am using PUN v1.80.

I am using on premise server and am not using PhotonNetwork.AuthValues

Am I missing a room setting or something to get this behaviour working correctly? I notice the exceptions are not created if CleanupCacheOnLeave = true but in the event of a short network disruption when the scene is still loaded and set up correctly in memory I would like to used the cached objects and views as is.

Thank you

Comments

  • Ricalex
    Options
    I was testing by just ordering photon to disconnect and attempt reconnect, but now that I have tried testing by pulling the LAN cable to simulate a real network problem I am getting the following error when attempting to do RejoinRoom

    Operation failed: OperationResponse 226: ReturnCode: 32746 (Join failed: UserId 'Janrx' already joined the specified game (JoinMode=3).). Parameters: {} Server: GameServer
    UnityEngine.Debug:LogError(Object)
    NetworkingPeer:OnOperationResponse(OperationResponse) (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/NetworkingPeer.cs:1535)
    ExitGames.Client.Photon.PeerBase:DeserializeMessageAndCallback(Byte[])
    ExitGames.Client.Photon.EnetPeer:DispatchIncomingCommands()
    ExitGames.Client.Photon.PhotonPeer:DispatchIncomingCommands()
    PhotonHandler:Update() (at Assets/Photon Unity Networking/Plugins/PhotonNetwork/PhotonHandler.cs:157)