PhotonTarget.AllBufferdViaServer not working

Options
Hi, I have a game where players need to navigate a maze and open doors. The problem is that players need to be able to rejoin the game. So to open the door I used an rpc with the photontarget allbufferdviaserver. But it just doens't do anything. The rpc is on a scene object and I also tried to make the photonview a takeover/request/fixed none of those options work. I presume this is because the rpc list from the player gets deleted on leaving. So I tried roomOptions.CleanupCacheOnLeave = false; but that breaks my autocleanupplayeronleave. Is there anything I am doing wrong? I really need this for my game! I hope someone knows a solution.

Comments

  • Hi @Gangafintie,

    when a player leaves the room, his buffered events get removed from the server's cache. This also happens when using AllBufferedViaServer. Since you already tried using RoomOptions.CleanupCacheOnLeave I guess you already have taken a look at the Cached Events documentation page. If not, maybe a look at that page helps you.

    Another option you have is to use the RaiseEvent function, which allows you to cache events 'permanently'. This is also stated in the above mentioned documentation page.

    There might be another option you can implement. This one uses the OnPhotonPlayerConnected(PhotonPlayer newPlayer) callback in order to inform each client about a newly connected client. The MasterClient can use this callback to notify the newly joined client about the state of the game with a certain event.
  • RoomOptions.CleanupCacheOnLeave is fine its just that my Player doesn't get removed when I leave the room.
  • The problem is that I want to destroy all the cliens objects BUT not the rpc's he send.
  • I tried this in the local player

    public override void OnPhotonPlayerDisconnected(PhotonPlayer _otherPlayer)
    {
    Debug.Log(_otherPlayer.NickName);
    Debug.Log(MyPhotonView.owner.NickName);
    if (MyPhotonView.owner == _otherPlayer && PhotonNetwork.isMasterClient) { PhotonNetwork.Destroy(MyPhotonView); }

    }

    Both the debugs register the same player but the object doesn't get destroyed :s?
  • I placed this in my NonLocalPlayer script and it works:

    public override void OnPhotonPlayerDisconnected(PhotonPlayer _otherPlayer)
    {
    if (_otherPlayer == origionalOwner && PhotonNetwork.isMasterClient)
    {
    PhotonNetwork.Destroy(gameObject);
    }
    }
    But I find it wierd that the owner of this photonview is chanced before this event triggers. I solved it by saving the origional owner and comparing it.