From a6e6c02c12609d9f83fb1ed88148f91759eecf8d Mon Sep 17 00:00:00 2001 From: Anton Franzluebbers Date: Sun, 30 Jan 2022 17:25:11 -0500 Subject: [PATCH] added sender id to custom message type, added trycatch to custom message handler --- Runtime/VelNetManager.cs | 2 +- Runtime/VelNetPlayer.cs | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Runtime/VelNetManager.cs b/Runtime/VelNetManager.cs index 0b5174b..4d4640e 100644 --- a/Runtime/VelNetManager.cs +++ b/Runtime/VelNetManager.cs @@ -81,7 +81,7 @@ namespace VelNet public static Action RoomsReceived; public static Action MessageReceived; - public static Action CustomMessageReceived; + public static Action CustomMessageReceived; #endregion diff --git a/Runtime/VelNetPlayer.cs b/Runtime/VelNetPlayer.cs index 1b8a3c0..21a3f7c 100644 --- a/Runtime/VelNetPlayer.cs +++ b/Runtime/VelNetPlayer.cs @@ -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: