What should i do when masterclient(sender) goes in Background in unity android.

Options
required solution => when master client goes in background i need to assign next master client if more then 1 player in room to continue sending process.

to do that i have done.
 void OnApplicationPause(bool pauseStatus)
{
if(pauseStatus)//true
{
 if (!PhotonNetwork.isMasterClient)
        {
            return;
        }
        if (PhotonNetwork.room.PlayerCount <= 1)
        {
            Debug.Log("You Are master and only one player");
            return;
        }       
        
        Debug.Log("Request to Change Next Master Client....!");        PhotonNetwork.SetMasterClient(PhotonNetwork.masterClient.GetNext());        
}
}


cause of this event by photon called  
public virtual void OnMasterClientSwitched(PhotonPlayer newMasterClient)
{
}
--My problem is this all event called when master client comes to foreground i want to call it before master client goes in to background.

-> i have also try to set PhotonNetwork.BackgroundTimeout = 2f;
so result will be in 2 second master client will disconnect from room after goes in background and photon will assign new master automatically and cause of this OnMastercClientSwitched() called and all other player continue game with new master client.but in this case disconnected player cant join same room again.

is there any solution for this.?

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Hi @wtdunity,

    Thank you for choosing Photon!

    I think you already solved this and posted your solution here already, right?