PhotonNetwork.Destroy(gameobject) with PhotonNetwork.autoCleanUpPlayerObjects = false
Options
Hello !
I want to destroy the gameobject of player that leave manually on the next round of the game, so i set PhotonNetwork.autoCleanUpPlayerObjects to false and give a bool for player that is leaving to check it when the round finished OnPhotonPlayerDisconnected(). The problem is when i want to destroy the gameobject it throws error : Failed to 'network-remove' GameObject. Client is neither owner nor masterClient taking over for owner who left : View(0) ......
I have set the PhotonView on player prefab to takeover and i can see that when the player leaves, the owner of that player becomes "Scene".
Below is the destroy gameobject code :
if(PhotonNetwork.isMasterClient) {
for(int b = 0; b<readyPlayer.Count; b++){
if(readyPlayer[b].isLeaving){
photonView.RPC("RemovePlayerFromList", PhotonTargets.AllBuffered, b);
PhotonNetwork.Destroy(readyPlayer[b].gameObject);
}
}
}
I have made some search and get info that the MasterClient can destroy it but it still throws error. Any help would be appreciated. Thanks.
I want to destroy the gameobject of player that leave manually on the next round of the game, so i set PhotonNetwork.autoCleanUpPlayerObjects to false and give a bool for player that is leaving to check it when the round finished OnPhotonPlayerDisconnected(). The problem is when i want to destroy the gameobject it throws error : Failed to 'network-remove' GameObject. Client is neither owner nor masterClient taking over for owner who left : View(0) ......
I have set the PhotonView on player prefab to takeover and i can see that when the player leaves, the owner of that player becomes "Scene".
Below is the destroy gameobject code :
if(PhotonNetwork.isMasterClient) {
for(int b = 0; b<readyPlayer.Count; b++){
if(readyPlayer[b].isLeaving){
photonView.RPC("RemovePlayerFromList", PhotonTargets.AllBuffered, b);
PhotonNetwork.Destroy(readyPlayer[b].gameObject);
}
}
}
I have made some search and get info that the MasterClient can destroy it but it still throws error. Any help would be appreciated. Thanks.
0