how to give over MasterClient, when start to watch Admob video?

Options
Hi.

There is a timer in my mobile game.
Masterclient does the countdown work, and send timer value to other clients.
When the masterclient begin watching video Ad, another player has to get masterclient instead, so that the timer function works continuously.
So I tried the code below.
void OnApplicationPause () {
    if (PhotonNetwork.isMasterClient && !(PhotonNetwork.playerList.Length)) {
        PhotonNetwork.SetMasterClient(PhotonNetwork.masterClient.GetNext());
    }
}
But with this code, masterclient was changed at the end of video ad, not when it starts to watch. so It didn't work.
And good way to keep the timer working???

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited January 2019
    Options
    Hi @FlippingFlop,

    You need to add PhotonNetwork.SendOutgoingCommands().
    void OnApplicationPause (bool paused) 
    {
        if (paused) 
        {
             if (PhotonNetwork.isMasterClient && !(PhotonNetwork.playerList.Length)) 
             {
                  PhotonNetwork.SetMasterClient(PhotonNetwork.masterClient.GetNext());
                  PhotonNetwork.SendOutgoingCommands();
             }
        }
    }