HELP: Can't add. Size exceeded
Options
This occurs for all clients after entering loading the game scene with multiple players, here's the full log:
Here's my code for joining / creating rooms:
StartAsHost() and JoinServer() are both called from buttons, connecting is done beforehand. I'm not sure what to do from here or what the error even means.
Exception: Can't add. Size exceeded.
at Photon.Pun.PhotonNetwork+SerializeViewBatch.Add (System.Collections.Generic.List`1 viewData) [0x00034] in C:\Users\adam\OneDrive\Documents\ProjectStarfighter\Assets\Photon\PhotonUnityNetworking\Code\PhotonNetworkPart.cs:1387 at Photon.Pun.PhotonNetwork.RunViewUpdate () [0x00123] in C:\Users\adam\OneDrive\Documents\ProjectStarfighter\Assets\Photon\PhotonUnityNetworking\Code\PhotonNetworkPart.cs:1464 at Photon.Pun.PhotonHandler.LateUpdate () [0x00025] in C:\Users\adam\OneDrive\Documents\ProjectStarfighter\Assets\Photon\PhotonUnityNetworking\Code\PhotonHandler.cs:146
Here's my code for joining / creating rooms:
StartAsHost() and JoinServer() are both called from buttons, connecting is done beforehand. I'm not sure what to do from here or what the error even means.
0
Comments
-
Found the issue.
I thought it was something to do with joining the room due to another similar issue I found on Google.
It was actually related to the Photon View component. Turns out it's not a good idea to read/write static lists in OnPhotonSerializeView.0 -
0
-
@Wschmidth : Can you elaborate how you caused this? What to avoid?
Others are reporting the same issue and we still didn't repro it.0 -
@Tobias I had the same issue, that OnPhotonSerializeView would throw this exception. My fault was that I tried to send actual objects, e.g. I had an InputData object I would send to the other players. When I replaced this with sending the contents of the InputData object instead it worked flawlessly.
Example:
Before:public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.IsWriting) { stream.SendNext(this.lastInput); } else { this.lastInput = (InputData)stream.ReceiveNext(); } }
After:public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) { if (stream.IsWriting) { this.lastInput.PhotonSendNext(stream); } else { this.lastInput = InputData.PhotonReceiveNext(stream); } }
0 -
@albin : Thanks for the input! Could you show the InputData class and how it de/serializes?
If it's a type that Photon doesn't know, you have to register de/serializer methods for this type. Then you should be able to send it as is. What you do in the "after" case, looks just as fine.0