Issue when master client leave

Hello all,

I'm developping a game with 2 players using a same room. So one is master client and the other a client.
i have a big issue when the master client leaves the room :

1-If the master client leaves the room, it seems that the scene is "reset" to initial loading state. For an example I intentionally destroy a game object (with no photonview), when master client leave that object appears again and all instantiated game object are destroyed.
2- but if the client leaves the room, all the instantiated game object remains.

I want only the master client instantiated game object to be destroyed and keep the scene exactly the same way.

Comments

  • Okay! I found what was causing this problem!
    If you want to remain in the scene with all the object :
    DON'T USE
    void start(){
    
    //the player will load the scene only if the master client loads the scene
    PhotonNetwork.AutomaticallySyncScene = true;
    }
    
    private void loadScene()
    {
    
    if (!PhotonNetwork.IsMasterClient) //if we are not the master client
                            return;
    PhotonNetwork.LoadLevel(sceneLvl)
    }
    

    but use this instead:
    void Start()
    {
    PhotonNetwork.AutomaticallySyncScene = false;
    }
    
    private void loadScene(){
    
    PhotonNetwork.LoadLevel(){
    SceneManager.LoadScene(sceneLvl);
    }