PUN2 - game freeze when calling SetInterestGroups on server

Options
Hey there,

after upgrading to PUN2 my game freezes as soon as i call

PhotonNetwork.SetInterestGroups (null, new byte[0]);

on the master client.
Did anyone ever run into a similar issue? Did anything change regarding interest groups that did change that i am not aware of? As far as i understood this function will make sure that i listen to all groups avaiable when i call it with those given arguments.

Thanks in advance for any advice/insight on this!

Comments

  • [Deleted User]
    edited December 2018
    Options
    Hi @Captain_Pineapple,

    thank you for the report. I have checked it and already found a solution.

    To fix the issue I'm asking you to navigate to the SetInterestGroups function (you can find it in the PhotonNetworkPart.cs file). In this function you will find the following for-loop: for (byte index = 0; index <= byte.MaxValue; index++) (should be around line 133x / 134x). Please replace this for-loop with the following one: for (byte index = 0; index < byte.MaxValue; index++). The only difference between both of them is the < operator instead of the <= operator. Using the < operator prevents the loop from being an infinite loop which causes the crash.

    Afterwards you have to add the last possible Interest Group on your own. You can do this by adding the following code snippet after the entire for-loop: allowedReceivingGroups.Add(byte.MaxValue);.

    This fix will also be part of the next update of the PUN 2 package.