// OnSpawnerReady(bool finishedSceneSetup) method is added to handle the On Ready Event of the SceneSpawner.
public void OnSpawnerReady(bool finishedSceneSetup, SceneSpawner sceneSpawner)
Debug.Log("OnSpawnerReady " + finishedSceneSetup);
// Check finishedSceneSetup to see if the scene has been set up before.
// If it is true, it means the player disconnected and reconnected to the game.
// In this case, we should not spawn a new Player GameObject for the player.
// If finishedSceneSetup is false, it means the player just started the game.
// We randomly select a SpawnPoint and ask the SceneSpawner to spawn a Player GameObject.
// we have 1 playerPrefabs so playerPrefabIndex is 0.
// We have 4 spawnPoints so we generated a random int between 0 to 3.
int spawnPointIndex = Random.Range(0, 3);
// Tell the spawner that we have finished setting up the scene.
// finishedSceneSetup will be true when SceneSpawn becomes ready next time.