From 251d3cd39281a0df80defcb48b9ca0ac9780d8a1 Mon Sep 17 00:00:00 2001 From: vis2k Date: Sat, 13 Mar 2021 18:36:52 +0800 Subject: [PATCH] NetworkClient.ClearLocalPlayer removed. clear it directly instead. --- Assets/Mirror/Runtime/NetworkClient.cs | 8 -------- Assets/Mirror/Runtime/NetworkIdentity.cs | 4 ++-- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/Assets/Mirror/Runtime/NetworkClient.cs b/Assets/Mirror/Runtime/NetworkClient.cs index 9ababed11..1ad29040c 100644 --- a/Assets/Mirror/Runtime/NetworkClient.cs +++ b/Assets/Mirror/Runtime/NetworkClient.cs @@ -818,14 +818,6 @@ internal static void InternalAddPlayer(NetworkIdentity identity) else Debug.LogWarning("No ready connection found for setting player controller during InternalAddPlayer"); } - // Sets localPlayer to null. Should be called when the local player - // object is destroyed. - internal static void ClearLocalPlayer() - { - //Debug.Log("NetworkClient.ClearLocalPlayer"); - localPlayer = null; - } - /// Sends AddPlayer message to the server, indicating that we want to join the world. public static bool AddPlayer() { diff --git a/Assets/Mirror/Runtime/NetworkIdentity.cs b/Assets/Mirror/Runtime/NetworkIdentity.cs index b48d46204..f38466bbf 100644 --- a/Assets/Mirror/Runtime/NetworkIdentity.cs +++ b/Assets/Mirror/Runtime/NetworkIdentity.cs @@ -549,7 +549,7 @@ void OnDestroy() // still points to US! // => see also: https://github.com/vis2k/Mirror/issues/2635 if (NetworkClient.localPlayer == this) - NetworkClient.ClearLocalPlayer(); + NetworkClient.localPlayer = null; } } @@ -1148,7 +1148,7 @@ internal void Reset() // see OnDestroy() comments. it does the same. // (https://github.com/vis2k/Mirror/issues/2635) if (NetworkClient.localPlayer == this) - NetworkClient.ClearLocalPlayer(); + NetworkClient.localPlayer = null; } isLocalPlayer = false; }