NetworkClient.ClearLocalPlayer removed. clear it directly instead.

This commit is contained in:
vis2k 2021-03-13 18:36:52 +08:00
parent 9cf4207819
commit 251d3cd392
2 changed files with 2 additions and 10 deletions

View File

@ -818,14 +818,6 @@ internal static void InternalAddPlayer(NetworkIdentity identity)
else Debug.LogWarning("No ready connection found for setting player controller during InternalAddPlayer"); 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;
}
/// <summary>Sends AddPlayer message to the server, indicating that we want to join the world.</summary> /// <summary>Sends AddPlayer message to the server, indicating that we want to join the world.</summary>
public static bool AddPlayer() public static bool AddPlayer()
{ {

View File

@ -549,7 +549,7 @@ void OnDestroy()
// still points to US! // still points to US!
// => see also: https://github.com/vis2k/Mirror/issues/2635 // => see also: https://github.com/vis2k/Mirror/issues/2635
if (NetworkClient.localPlayer == this) if (NetworkClient.localPlayer == this)
NetworkClient.ClearLocalPlayer(); NetworkClient.localPlayer = null;
} }
} }
@ -1148,7 +1148,7 @@ internal void Reset()
// see OnDestroy() comments. it does the same. // see OnDestroy() comments. it does the same.
// (https://github.com/vis2k/Mirror/issues/2635) // (https://github.com/vis2k/Mirror/issues/2635)
if (NetworkClient.localPlayer == this) if (NetworkClient.localPlayer == this)
NetworkClient.ClearLocalPlayer(); NetworkClient.localPlayer = null;
} }
isLocalPlayer = false; isLocalPlayer = false;
} }