Serialization in Photon - StreamBuffer Method
Options
Hello
Thank you for Photon Service. It's very easy to use.
I need so help with the Serialization using StreamBuffer Method.
Indeed I have a large bytes array and I cannot use the classical Byte Array Method:
https://doc.photonengine.com/en-us/pun/current/reference/serialization-in-photon
So I will trying to use the StreamBuffer Method but I don't know how to do.
Example:
Can you help me?
Thank you
Thank you for Photon Service. It's very easy to use.
I need so help with the Serialization using StreamBuffer Method.
Indeed I have a large bytes array and I cannot use the classical Byte Array Method:
https://doc.photonengine.com/en-us/pun/current/reference/serialization-in-photon
So I will trying to use the StreamBuffer Method but I don't know how to do.
Example:
public class MyCustomStreamSerialization { public byte[] MyBytes; public static short Serialize(StreamBuffer outStream, object obj) { MyCustomStreamSerialization data = (MyCustomStreamSerialization)obj; lock (data) { outStream.Write(data.MyBytes, 0, 2 * 4); } return 2 * 4; } public static object Deserialize(StreamBuffer inStream, short length) { MyCustomStreamSerialization data = new MyCustomStreamSerialization(); lock (data) { inStream.Read(data.MyBytes, 0, 2 * 4); } return data; } }
Can you help me?
Thank you
0
Comments
-
There are CustomTypes.cs and CustomTypesUnity.cs in the project. Have a look at them as reference.
Right now, I don't get how we need to help.0