-
-
Notifications
You must be signed in to change notification settings - Fork 754
Closed
Description
Heya all. I am making a small online RPG that uses primarily network messages for everything so I wanted to try out some serialization stuff because I need to send some bytes and dictionaries around. This is my first time having a go at serialization and I thought I had it right but it keeps failing when it gets to the actual serialization part.
Thanks!
```
public byte[] message { get; set; }
public Dictionary<byte, object> test1 = new Dictionary<byte, object>();
public byte cc;
public byte cc2;
public GameObject cube;
cc = (byte)ClientOperationCode.Chat;
cc2 = (byte)ClientEventCode.ChatChannelJoined;
test1.Add(cc, cube);
serial.Serializer(cc2, test1); // <------------------------ Doesn't get past here
//-------------------------------------------------------------
[MessagePackObject]
public class SerializeOperationRequest
{
[Key(0)] public byte opCode { get; set; }
[Key(1)] public Dictionary<byte, object> parameters { get; set; }
}
public class CreateSerializedObject
{
private NOC noc;
public void Serializer(byte oper, Dictionary<byte, object> param)
{
var op = new SerializeOperationRequest
{
opCode = oper,
parameters = param,
};
var msg = LZ4MessagePackSerializer.Serialize(op);
noc.message = msg;
Debug.Log("Serialized");
program.DeserializeEvent(noc.message);
Debug.Log("Sent to deserializer");
}
}
Metadata
Metadata
Assignees
Labels
No labels