Callback for master client switch failed.

How can I handle cases where SetMasterClient() fails? Is there a callback that will be called?

E.g. sometimes we get:
"Operation failed: OperationResponse 252: ReturnCode: -2 (MasterClientId value '2' is invalid. No actor with such number). Parameters: {} Server: GameServer"
when we try to set the master client to another players that just left the room.

Best, He.

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @heen,

    Currently, we do not have a callback for that sorry.
    Just to make sure, do you use PUN1 or PUN2?
  • We are still on PUN1. Most likely will switch over to PUN2 in January.

    I probably should have explained my question a bit more. In our game we use the master client to start the match and split players into teams. We would like to have an option to switch the master client to the one player with the best ping. But currently we only trust the system to give us a master client.

    Our setup requires that there is only one single client time that think he is the master client at a time. If we call SetMasterClient we could tell the current master to wait. This to avoid having two master clients at the same time. But as noted, it is possible that setting a new master client fails. Hence, resulting in no master client.

    Of course, the best way would be to design our system be fail safe. So that any client could send start messages etc. Not a super easy thing to refactor, but maybe worth a shot...

    Best, He