fix(Additive Levels Example): Simplified Portal::SendPlayerToNewScene

This commit is contained in:
MrGadget 2024-09-30 14:59:47 -04:00
parent c1b5053004
commit 80df4d66b6

View File

@ -60,8 +60,8 @@ void OnTriggerEnter(Collider other)
[ServerCallback] [ServerCallback]
IEnumerator SendPlayerToNewScene(GameObject player) IEnumerator SendPlayerToNewScene(GameObject player)
{ {
if (player.TryGetComponent(out NetworkIdentity identity)) if (!player.TryGetComponent(out NetworkIdentity identity)) yield break;
{
NetworkConnectionToClient conn = identity.connectionToClient; NetworkConnectionToClient conn = identity.connectionToClient;
if (conn == null) yield break; if (conn == null) yield break;
@ -98,4 +98,3 @@ IEnumerator SendPlayerToNewScene(GameObject player)
} }
} }
} }
}