in UnityProject/Assets/Scripts/Client/Client.cs [92:118]
IEnumerator ConnectToServer()
{
FindObjectOfType<UIManager>().SetTextBox("Connecting to backend..");
yield return null;
// Start network client and connect to server
this.networkClient = new NetworkClient();
// We will wait for the matchmaking and connection coroutine to end before creating the player
yield return StartCoroutine(this.networkClient.RequestGameSession());
if (this.networkClient.ConnectionSucceeded())
{
// Create character
this.localPlayer = new NetworkPlayer(0);
this.localPlayer.Initialize(characterPrefab, new Vector3(UnityEngine.Random.Range(-5,5), 1, UnityEngine.Random.Range(-5, 5)));
this.localPlayer.ResetTarget();
this.networkClient.SendMessage(this.localPlayer.GetSpawnMessage());
}
else
{
// Connection failed, restart the scene to try again
UnityEngine.SceneManagement.SceneManager.LoadScene(0);
}
yield return null;
}