/// <summary> /// Sets up player game objects and components. /// </summary> /// <param name="players">How many players are in this game?</param> public void PreparePlayers(int players) { for (int x = 0; x < players; x++) { GameObject playerObject = Instantiate(playerPrefab) as GameObject; Player playerComponent = playerObject.GetComponent <Player>(); Placeable placeableComponent = playerObject.GetComponent <Placeable>(); playerObject.transform.SetParent(GameObject.Find("PlayerRoot").transform); playerComponent.placeable = placeableComponent; playerComponent.playerIndex = x; playerComponent.currentTileNumber = 0; placeableComponent.PlaceAtTile(0); if (x == 0) { player = playerComponent; } } }