hey,
I use PUN in my game,When Master Client player press Home button on mobile or switch to other application,I want to switch that master client to other players in room,But I always got an err :Operation failed: OperationResponse 252: ReturnCode: -2 (CAS update failed: property='248' has value='2'). Parameters: {} Server: GameServer
here is my code:
void OnApplicationPause(bool pauseStatus)
{
Debug.Log ("AppStatus:" + pauseStatus);
isPaused = pauseStatus;
if (isPaused&&PhotonNetwork.isMasterClient) {
SwithMasterClient ();
//photonView.RPC ("SwithMasterClient", PhotonTargets.Others, null);//do not work eighter
}
}
[PunRPC]
void SwithMasterClient(){
Debug.Log ("SwithMaster");
PhotonNetwork.SetMasterClient (PhotonNetwork.masterClient.GetNext());
}
public void SwithMaster(){
Debug.Log ("SwithMaster2");
PhotonNetwork.SetMasterClient (PhotonNetwork.masterClient.GetNext());
}
void OnGUI()
{
if (isPaused)
GUI.Label(new Rect(100, 130, 50, 30), "Game paused");
GUI.Label(new Rect(100, 160, 300, 50), "是否Master:"+PhotonNetwork.isMasterClient.ToString());
}
void OnMasterClientSwitched(){
Debug.Log ("MasterClientSwitched");
}
When I read the log, I found when I press the the home button, no message output,when I enter the app again,It will Debug.Log ("AppStatus true") then AppStatus False, And Switch the MasterClient ,then gives the err above.
I use PUN in my game,When Master Client player press Home button on mobile or switch to other application,I want to switch that master client to other players in room,But I always got an err :Operation failed: OperationResponse 252: ReturnCode: -2 (CAS update failed: property='248' has value='2'). Parameters: {} Server: GameServer
here is my code:
void OnApplicationPause(bool pauseStatus)
{
Debug.Log ("AppStatus:" + pauseStatus);
isPaused = pauseStatus;
if (isPaused&&PhotonNetwork.isMasterClient) {
SwithMasterClient ();
//photonView.RPC ("SwithMasterClient", PhotonTargets.Others, null);//do not work eighter
}
}
[PunRPC]
void SwithMasterClient(){
Debug.Log ("SwithMaster");
PhotonNetwork.SetMasterClient (PhotonNetwork.masterClient.GetNext());
}
public void SwithMaster(){
Debug.Log ("SwithMaster2");
PhotonNetwork.SetMasterClient (PhotonNetwork.masterClient.GetNext());
}
void OnGUI()
{
if (isPaused)
GUI.Label(new Rect(100, 130, 50, 30), "Game paused");
GUI.Label(new Rect(100, 160, 300, 50), "是否Master:"+PhotonNetwork.isMasterClient.ToString());
}
void OnMasterClientSwitched(){
Debug.Log ("MasterClientSwitched");
}
When I read the log, I found when I press the the home button, no message output,when I enter the app again,It will Debug.Log ("AppStatus true") then AppStatus False, And Switch the MasterClient ,then gives the err above.