Initializing offline mode to true, change to false in game

Hi, I'm having some trouble with using the offline mode flag. My goal is to have the single player version of our game operate identically to before integrating Photon, so I am using offline mode = true when I start the game, then when wherever we had Instantiate calls before I now do PhotonNetwork.Instantiate (btw, what is the usage of the group argument in that method?)

This all works great, but when I want to go through the online pathway, I set offline mode to false and then connect to the lobby and rooms of the LoadBalancingPeer service. What I find is that the PhotonNetwork.isMasterClient is true for all clients now which is causing issues for my game logic.

I think this is happening because I first set offlineMode to true, which executes this code in the setter (about line 250 in PhotonNetwork.cs):
                if (isOfflineMode)
                {

                    NetworkingPeer.SendMonoMessage(PhotonNetworkingMessage.OnConnectedToPhoton);

                    networkingPeer.ChangeLocalID(1);

                    networkingPeer.mMasterClient = player;

                }

And then I set it to false, but there is no code that reverts the code above.

Is there anything that can be done to overcome this issue?

Thanks

Comments

  • Good find!
    I think the following should address this. I have added it to the 1.9.5 BETA which I'll upload for testing on this forum.
    else{
         networkingPeer.ChangeLocalID(-1);
         networkingPeer.mMasterClient = null;
    }
    
  • That does seem to address the issue, thanks.
Sign In or Register to comment.