public bool TestNetworkPacketSerialization() { Color sourceColor = new Color(.1f, .2f, .3f); NetworkMessageStruct networkMessageStruct = new NetworkMessageStruct { Type = MessageType.ColorChange, Message = SerializeColor(sourceColor) }; byte[] serializeMessage = networkMessageStruct.Serialize(); NetworkMessageStruct deserializedStruct = NetworkMessageStruct.Deserialize(serializeMessage); return(networkMessageStruct.Type == deserializedStruct.Type && VerifyColor(sourceColor, DeserializeColor(deserializedStruct.Message))); }
protected override void SendMessage(NetworkMessageStruct message) { Debug.Log("Send message to all friends"); UnityMCSessionNativeInterface.GetMcSessionNativeInterface().SendToAllPeers(message.Serialize()); }