diff --git a/Assets/Mirror/Runtime/MessagePacker.cs b/Assets/Mirror/Runtime/MessagePacker.cs index 20eed78ec..bf9a0ec17 100644 --- a/Assets/Mirror/Runtime/MessagePacker.cs +++ b/Assets/Mirror/Runtime/MessagePacker.cs @@ -85,7 +85,7 @@ public static bool UnpackMessage(NetworkReader messageReader, out int msgType) } } - 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) => diff --git a/Assets/Mirror/Runtime/NetworkClient.cs b/Assets/Mirror/Runtime/NetworkClient.cs index b6d4bfdd7..4ab525fb4 100644 --- a/Assets/Mirror/Runtime/NetworkClient.cs +++ b/Assets/Mirror/Runtime/NetworkClient.cs @@ -204,7 +204,7 @@ public static void RegisterHandler(Action handler, bool { Debug.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); } /// diff --git a/Assets/Mirror/Runtime/NetworkServer.cs b/Assets/Mirror/Runtime/NetworkServer.cs index 5e7b0f765..bd5305c22 100644 --- a/Assets/Mirror/Runtime/NetworkServer.cs +++ b/Assets/Mirror/Runtime/NetworkServer.cs @@ -475,7 +475,7 @@ public static void RegisterHandler(Action handler, bool { Debug.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); } /// @@ -502,7 +502,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); } ///