From d186dfdf9b6ded93eb5d62ab7d54704b918249f6 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 --- .../Packages/VelNetUnity/Runtime/VelNetManager.cs | 2 +- .../Packages/VelNetUnity/Runtime/VelNetPlayer.cs | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/TestVelGameServer/Packages/VelNetUnity/Runtime/VelNetManager.cs b/TestVelGameServer/Packages/VelNetUnity/Runtime/VelNetManager.cs index 0b5174b..4d4640e 100644 --- a/TestVelGameServer/Packages/VelNetUnity/Runtime/VelNetManager.cs +++ b/TestVelGameServer/Packages/VelNetUnity/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/TestVelGameServer/Packages/VelNetUnity/Runtime/VelNetPlayer.cs b/TestVelGameServer/Packages/VelNetUnity/Runtime/VelNetPlayer.cs index 1b8a3c0..21a3f7c 100644 --- a/TestVelGameServer/Packages/VelNetUnity/Runtime/VelNetPlayer.cs +++ b/TestVelGameServer/Packages/VelNetUnity/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: