Exception: Can't add. Size exceeded.

I have a Dictionary that I am trying to send in OnPhotonSerializeView. Unfortunately, when I do this, it throws an exception as follows-


Exception: Can't add. Size exceeded.
at Photon.Pun.PhotonNetwork+SerializeViewBatch.Add (System.Collections.Generic.List`1 viewData) [0x00034] in C:\Projects\IncidentCommander\IC_Unity\Incident Commander\Assets\Plugins\Photon\PhotonUnityNetworking\Code\PhotonNetworkPart.cs:1390
at Photon.Pun.PhotonNetwork.RunViewUpdate () [0x00123] in C:\Projects\IncidentCommander\IC_Unity\Incident Commander\Assets\Plugins\Photon\PhotonUnityNetworking\Code\PhotonNetworkPart.cs:1467
at Photon.Pun.PhotonHandler.LateUpdate () [0x00025] in C:\Projects\IncidentCommander\IC_Unity\Incident Commander\Assets\Plugins\Photon\PhotonUnityNetworking\Code\PhotonHandler.cs:132


Is this not supported? The docs on Serialization says it should be. I'm using PUN 2.9 and my code is simple-

    public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info)
    {
        if (stream.IsWriting)
        {
            stream.SendNext(MyData);
        }
        else
        {
            MyData = stream.ReceiveNext() as Dictionary;
        }
    }
I have verified that MyType otherwise works correctly, and also sending arrays of the keys and values also works as a workaround. It just doesn't seem to like my Dictionary.

Comments

  • The problem doesn't seem to be the Type of MyData but the amount of values in the update batch.
    Are there exceptions anywhere, before this happens?
    Could you send a simple repro case?
  • Hi @jRocket,

    Thank you for choosing Photon!

    This other discussion is related and could contain a solution to your problem.
Sign In or Register to comment.