Can't manage to use RemoveRPCsInGroup

I would like to use "RemoveRPCsInGroup" in order to delete bufferedRPC but I can't manage to delete RPCs.
I want to use only 2 groups (without using the broadcasting group 0).
First, I set SetSendingEnable(0,false), and SetInterestGroup(1,true) and SetInterestGroup(2,true).
During 1mn I want to send only the message on one group (alternately I switch the group number 1 to 2 each 2mn).
To start I set the to 1, and then I make a RPC call using "bufferedOthers" as a target.
After 1mn, I switch and set the to 2, and the make RPC buffered call.
After 1mn30s I want to clear the buffer RPC send to group 1 (alternately I will remove buffered RPC of group 2 at 2mn30s). So I do a RemoveRPCsInGroup(1).
I launch my first client, I let spend 1mn40s, then I launch my second client. The behaviour I would like will be to receive only the buffered RPC in group 2 and nothing from group 1 (because RPC should have been removed). But I receive all the buffered RPC. To be sure I was not receiving RPC from group 0 I also make a RemoveRPCInGroup(0) each mn but it changes nothing. What I am doing wrong?
The aim of all that is to use buffered RPC but avoiding to have too much buffered RPC when a client is arriving after a long time. (actions RPC have done is "saved" an other way each mn).
Thanks for any help...

Best Answer


  • Hi Christian,
    thanks for your answer. If I understand well your answer when I use PhotonNetwork.RemoveRPCInGroup(1), a the moment I use this remove function only photonViews with group set to 1 at that time will be removed. It will explain the behaviour I have.
    I am going to try that, thanks again.
  • Hi,
    I just confirm you were right Christian, thanks. And it seems when you use RemoveRPCInGroup it removes all the RPCs of the photonView, even RPC emitted with a different group in the past. For instance, If I send buffered RPC with photonView.Group=1, then switch the same photoView on group 2. Then use RemoveRPCInGroup by using group 1 (en set the photonView to 1 juste before). All emitted RPCs are removed not only RPC of group 1. So what I would like to do is not possible. I'll do it an other way.
  • Hi @gildas,

    Thank you for choosing Photon!

    FYI: you can't cache/buffer events/RPCs in a group other than group 0.
    You can read this on these two pages:
    - Interest Groups
    - Cached Events
  • Hi @JohnTube,
    Thanks for the info and thanks for Photon!
    I had read the doc but I was not sure about buffered RPC only on group 0.
    In particular because if you can't have buffered RPC on other group than 0, what is the use of the function RemoveRPCInGroup with group as a parameter?
    Like I was not sure, I used "SetSendingEnable(0,false)" to avoid sending on group 0 (but RPCs are send anyway?). Because other clients who connect after the master received well buffered RPC of the photonView (I beleived it was from group 1 as I send only on group 1?)
    And finally, when I did a RemoveRPCInGroup(1) with a =1 it was the RPC on group 0 that I deleted?

Sign In or Register to comment.