Multiplayer spawn points

Hi everyone. Ok so what I have is two spawnpoints (empty gameObjects) in a sceen. What I want to do is to change the spawn point when a player joins the game. Right now all the ever happens is that both players spawn at the same point. What is a good way of changing that so say 14 players can join a game and spawn at different points based on when the joined.

I was think like an array but I have not the foggiest idea on how to implement that, i.e. know how many players have joined the game.

this is how im spawning the player now
Network.Instantiate(playerPrefab, sp1.position, Quaternion.identity, 0);

i need to change the sp1.position for each player.

Thanks for any help with this.

I’d suggest using an integer that increases everytime a player joins (and decreases when a player disconnects) then use that as your array key. for instance:

var playerCount : int = 0;
var spawnPoints : Transform[];


Network.Instantiate(playerPrefab, spawnPoints[playerCount], Quaternion.identity, 0);
playerCount++;