- Home /
[Photon] Culling - SetIntrestGroups/SetSendingEnabled not working
Hello there,
in my current project i am trying to reduce network traffic by implementing a custom culling mechanism. This means for example when players have a large distance between them i can send less position updates since you can't see it either way.
Photon has the functionality of Intrest Groups as described here in the documentation. From what i understood there is that intrest groups are basically channels on which a photonView will listen for messages. These can be set by SetIntrestGroups() and the sending pendant (so to which groups i am sending updates) is SetSendingEnabled().
Problem is: I can't get messages to work on a different group than the default 0 group. Whenever i change the group via the code snippet given here I'm not able to recieve any message anymore:
if (Input.GetKeyDown (KeyCode.Alpha9)) {
PhotonNetwork.SetSendingEnabled (new byte[]{0}, new byte[]{1});
PhotonNetwork.SetInterestGroups (null, new byte[0]);
Debug.Log ("switch");
}
if (Input.GetKeyDown (KeyCode.Alpha8)) {
PhotonNetwork.SetSendingEnabled (new byte[]{1}, new byte[]{0});
PhotonNetwork.SetInterestGroups (new byte[]{1}, null);
Debug.Log ("switch2");
}
Pressing the key 9 changes the groups to recieve on all groups and to only send on group 1. Pressing 8 changes it back and i recieve messages again.
If anyone has more insight on how to use these groups i'd be happy if you could enlighten me. If you need more info on the code please let me know. Thanks in advance!
Bonus question: Do intrest group get set per photon view or per programm instance?