diff --git a/Assets/Mirror/Runtime/MessagePacker.cs b/Assets/Mirror/Runtime/MessagePacker.cs index cf40ce2da..2b25461b5 100644 --- a/Assets/Mirror/Runtime/MessagePacker.cs +++ b/Assets/Mirror/Runtime/MessagePacker.cs @@ -59,7 +59,7 @@ public static bool UnpackMessage(NetworkReader messageReader, out int msgType) } // wraps a handler function with extra code - internal static NetworkMessageDelegate MessageHandler(Action handler, bool requireAuthenication) + internal static NetworkMessageDelegate WrapHandler(Action handler, bool requireAuthenication) where T : struct, NetworkMessage where C : NetworkConnection => (conn, reader, channelId) => diff --git a/Assets/Mirror/Runtime/NetworkClient.cs b/Assets/Mirror/Runtime/NetworkClient.cs index 0d154bc07..b73df2913 100644 --- a/Assets/Mirror/Runtime/NetworkClient.cs +++ b/Assets/Mirror/Runtime/NetworkClient.cs @@ -315,7 +315,7 @@ public static void RegisterHandler(Action handler, bool { logger.LogWarning($"NetworkClient.RegisterHandler replacing handler for {typeof(T).FullName}, id={msgType}. If replacement is intentional, use ReplaceHandler instead to avoid this warning."); } - handlers[msgType] = MessagePacker.MessageHandler(handler, requireAuthentication); + handlers[msgType] = MessagePacker.WrapHandler(handler, requireAuthentication); } /// @@ -342,7 +342,7 @@ public static void ReplaceHandler(Action handler, bool where T : struct, NetworkMessage { int msgType = MessagePacker.GetId(); - handlers[msgType] = MessagePacker.MessageHandler(handler, requireAuthentication); + handlers[msgType] = MessagePacker.WrapHandler(handler, requireAuthentication); } /// diff --git a/Assets/Mirror/Runtime/NetworkServer.cs b/Assets/Mirror/Runtime/NetworkServer.cs index 93bdff76d..28f18a684 100644 --- a/Assets/Mirror/Runtime/NetworkServer.cs +++ b/Assets/Mirror/Runtime/NetworkServer.cs @@ -596,7 +596,7 @@ public static void RegisterHandler(Action handler, bool { logger.LogWarning($"NetworkServer.RegisterHandler replacing handler for {typeof(T).FullName}, id={msgType}. If replacement is intentional, use ReplaceHandler instead to avoid this warning."); } - handlers[msgType] = MessagePacker.MessageHandler(handler, requireAuthentication); + handlers[msgType] = MessagePacker.WrapHandler(handler, requireAuthentication); } /// @@ -623,7 +623,7 @@ public static void ReplaceHandler(Action handler, bool where T : struct, NetworkMessage { int msgType = MessagePacker.GetId(); - handlers[msgType] = MessagePacker.MessageHandler(handler, requireAuthentication); + handlers[msgType] = MessagePacker.WrapHandler(handler, requireAuthentication); } ///