Skip to content

Hey there, if someone doesn't mind taking a look at this, I can't quite tell what is wrong? #230

@MostHated

Description

@MostHated

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions