mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-17 18:40:33 +00:00
fix(Additive Levels Example): Simplified Portal::SendPlayerToNewScene
This commit is contained in:
parent
c1b5053004
commit
80df4d66b6
@ -27,7 +27,7 @@ public void OnLabelTextChanged(string _, string newValue)
|
||||
|
||||
public override void OnStartServer()
|
||||
{
|
||||
labelText = Path.GetFileNameWithoutExtension(destinationScene).Replace("MirrorAdditiveLevels","");
|
||||
labelText = Path.GetFileNameWithoutExtension(destinationScene).Replace("MirrorAdditiveLevels", "");
|
||||
|
||||
// Simple Regex to insert spaces before capitals, numbers
|
||||
labelText = Regex.Replace(labelText, @"\B[A-Z0-9]+", " $0");
|
||||
@ -60,8 +60,8 @@ void OnTriggerEnter(Collider other)
|
||||
[ServerCallback]
|
||||
IEnumerator SendPlayerToNewScene(GameObject player)
|
||||
{
|
||||
if (player.TryGetComponent(out NetworkIdentity identity))
|
||||
{
|
||||
if (!player.TryGetComponent(out NetworkIdentity identity)) yield break;
|
||||
|
||||
NetworkConnectionToClient conn = identity.connectionToClient;
|
||||
if (conn == null) yield break;
|
||||
|
||||
@ -97,5 +97,4 @@ IEnumerator SendPlayerToNewScene(GameObject player)
|
||||
playerController.enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user