OnMasterClientSwitched not being called
Options
I log on with my app as Master and see in the console: connected to master
But when I leave a room my code fires and I leave the room and am returned to the lobby, but OnMasterClientSwitched is not being called?
But when I leave a room my code fires and I leave the room and am returned to the lobby, but OnMasterClientSwitched is not being called?
0
Comments
-
Hi @piginhat,
Thank you for choosing Photon!
I think there is a confusion here, I hope I'm wrong:
There is Master Server (Photon LoadBalancing server application) and Master Client (client, actor joined to a room with the lowest actor number).
Master Server is what you connect to to do matchmaking and join lobbies.
Game Server however is what you connect to when you join the room.
When a Master Client leaves and there is at least another actor joined, a new Master Client is chosen by the server, soOnMasterClientSwitched
is triggered on other joined actors if any.
Read more about "LoadBalancing Application".
Read more about "Master Client and Host Migration".0 -
Thanks for prompt reply :-)
OK, maybe I left a bit out.
I run the app on a device and in editor. The mobile device creates the room and joins and then the editor joins the room, so we have two players in the room.
Now I want to close the room if master leaves so no players are left in there. So I do this:// // callback from Photon when master leaves tutorial and called on all players // private void OnMasterClientSwitched(PhotonPlayer newMasterClient) { print ("I ma master leaving tutorial"); // as master (tutor) has left force all students to leave tutorial PhotonNetwork.LeaveRoom (); }
so when the mobile device user (master) leaves the room this should get called and then makes the remaining player leave the room.
correct?
Thanks0 -
My assumption was correct, I found the error in my project and it works as expected now0