InternalReplacePlayerForConnection: call GetComponent directly.

This commit is contained in:
vis2k 2019-01-16 20:42:31 +01:00
parent 7d439f0c20
commit 892d894d0f

View File

@ -615,8 +615,8 @@ static void FinishPlayerForConnection(NetworkConnection conn, NetworkIdentity id
internal static bool InternalReplacePlayerForConnection(NetworkConnection conn, GameObject playerGameObject)
{
NetworkIdentity playerNetworkIdentity;
if (!GetNetworkIdentity(playerGameObject, out playerNetworkIdentity))
NetworkIdentity playerNetworkIdentity = playerGameObject.GetComponent<NetworkIdentity>();
if (playerNetworkIdentity == null)
{
Debug.LogError("ReplacePlayer: playerGameObject has no NetworkIdentity. Please add a NetworkIdentity to " + playerGameObject);
return false;