From b7a6932b9351686b5d6b49135eeba75e7ee9d3c1 Mon Sep 17 00:00:00 2001 From: vis2k Date: Thu, 13 May 2021 12:06:00 +0800 Subject: [PATCH] use local function --- Assets/Mirror/Runtime/NetworkClient.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Assets/Mirror/Runtime/NetworkClient.cs b/Assets/Mirror/Runtime/NetworkClient.cs index 35090c1c4..6afef3e67 100644 --- a/Assets/Mirror/Runtime/NetworkClient.cs +++ b/Assets/Mirror/Runtime/NetworkClient.cs @@ -329,8 +329,8 @@ public static void RegisterHandler(Action handler, bool requireAuthenticat // we use the same WrapHandler function for server and client. // so let's wrap it to ignore the NetworkConnection parameter. // it's not needed on client. it's always NetworkClient.connection. - Action handlerWrapped = (_, value) => { handler(value); }; - handlers[msgType] = MessagePacking.WrapHandler(handlerWrapped, requireAuthentication); + void HandlerWrapped(NetworkConnection _, T value) => handler(value); + handlers[msgType] = MessagePacking.WrapHandler((Action) HandlerWrapped, requireAuthentication); } /// Replace a handler for a particular message type. Should require authentication by default.