Cannot serialize... System.String?

Hi everyone,

I'm a Photon noob so bear with me here. I'm trying to pass a Dictionary<string, Transform> in OnPhotonSerializeView as such:
public static Dictionary<string, Transform> torpDict = new Dictionary<string, Transform>();
public static Dictionary<string, Transform> masterTorpDict;
.
.
.
public void OnPhotonSerializeView(PhotonStream stream, PhotonMessageInfo info) {
if (stream.isWriting & PhotonNetwork.isMasterClient) {
stream.SendNext (torpDict);
}
else {
masterTorpDict = (Dictionary<string, Transform>) stream.ReceiveNext();
}

And I'm getting this error:
Exception: Unexpected - cannot serialize Dictionary with value type: System.String

I thought strings and dictionaries were kosher for Photon serialization? What am I doing wrong?

Comments

  • Are you sure that is the full error message?
    The Transform is not kosher. It can't be serialized and even if, you can't apply a Transform to any object.
    You can send Vector3s and Quaternions.