OnMasterClientSwitched() not working

After I update to PUN v.1.18 OnMasterClientSwitched() is not working anymore.

I've try to use Debug.Log() inside OnMasterClientSwitched() and then let the masterclient leave game's room.
Then, nothing happened. Debug.Log() inside OnMasterClientSwitched() not being called.

Here's my code.
void OnMasterClientSwitched( PhotonPlayer newMaster )
{
Debug.Log("The old masterclient left, we have a new masterclient: " + newMaster);
}

EDIT:

I've try it in DemoWorker and OnMasterClientSwitched() still not working though.
Anyway, I manage to avoid the issue by using OnPhotonPlayerDisconnected() instead.

Comments

  • Ouch.
    You're right.

    Fix method CheckMasterClient() in NetworkingPeer.cs. Last couple of lines must be:

    [code2=csharp]if (this.mMasterClient == null || this.mMasterClient.ID != lowestActorNumber)
    {
    this.mMasterClient = this.mActors[lowestActorNumber];

    bool leavingPlayerWasMaster = ignoreActorID > 0; // that value is the playerID who's leaving or -1
    if (leavingPlayerWasMaster)
    {
    SendMonoMessage(PhotonNetworkingMessage.OnMasterClientSwitched, this.mMasterClient);
    }
    }[/code2]

    I'll fix in PUN 1.19.1 (will be re-released today).