- Home /
 
Photon OnPhotonPlayerDisconnected Works For Only Master Client
Hello, i'm making team and slot system by using photon
My issue: I need to release slots when someone disconnected by using OnPhotonPlayerDisconnected. But it's only works for master client.
My Scripts:
TeamSlotRemover.cs
 public TeamSelection teamSelection;
 
  public void OnPhotonPlayerDisconnected(PhotonPlayer player)
   {         
         int slotindexwilldelete = (int)player.CustomProperties["slot_index"];       
         teamSelection.ReleaseSlot(slotindexwilldelete);       
   }
 
               TeamSelection.cs
 public void ReleaseSlot(int index)
   {
         Hashtable updateSlots2 = new Hashtable();
         updateSlots2.Add("teamslot" + index.ToString(), false);
         PhotonNetwork.room.SetCustomProperties(updateSlots2, null, false);
         Slots[index] = false;
  }
 
               Both script added my GameManager Object which is drag and dropped to scene. When i call "ReleaseSlot" method directly by using UI buttons, it does works perfect for every clients. I only can't achieve, making this when someone disconnected.
Thanks.
cannot see any obvious problems but: if every player sets a value for the same room custom property when a player disconnects this is a rather bad idea. This should acutally only be done by the master...
Your answer
 
             Follow this Question
Related Questions
Networking: Keep room alive without active players 0 Answers
How many current players will I get daily if I have 10k installs 1 Answer
Photon - How to spawn enemies that don't have a PhotonView and be synced with other clients 1 Answer
RPC to certain player in room using their nickname/userID 0 Answers