added sender id to custom message type, added trycatch to custom message handler
parent
997c2d5738
commit
a6e6c02c12
|
|
@ -81,7 +81,7 @@ namespace VelNet
|
|||
public static Action<RoomsMessage> RoomsReceived;
|
||||
|
||||
public static Action<Message> MessageReceived;
|
||||
public static Action<byte[]> CustomMessageReceived;
|
||||
public static Action<int, byte[]> CustomMessageReceived;
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
|
|||
|
|
@ -137,7 +137,15 @@ namespace VelNet
|
|||
case VelNetManager.MessageType.Custom: // custom packets
|
||||
{
|
||||
int len = reader.ReadInt32();
|
||||
VelNetManager.CustomMessageReceived?.Invoke(reader.ReadBytes(len));
|
||||
try
|
||||
{
|
||||
VelNetManager.CustomMessageReceived?.Invoke(m.senderId, reader.ReadBytes(len));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Debug.LogError(e);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
|||
Loading…
Reference in New Issue